当前位置: 首页>>代码示例>>Java>>正文


Java CacheResolver类代码示例

本文整理汇总了Java中org.springframework.cache.interceptor.CacheResolver的典型用法代码示例。如果您正苦于以下问题:Java CacheResolver类的具体用法?Java CacheResolver怎么用?Java CacheResolver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CacheResolver类属于org.springframework.cache.interceptor包,在下文中一共展示了CacheResolver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createCacheResultOperation

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
protected CacheResultOperation createCacheResultOperation(Method method, CacheDefaults defaults, CacheResult ann) {
	String cacheName = determineCacheName(method, defaults, ann.cacheName());
	CacheResolverFactory cacheResolverFactory =
			determineCacheResolverFactory(defaults, ann.cacheResolverFactory());
	KeyGenerator keyGenerator = determineKeyGenerator(defaults, ann.cacheKeyGenerator());

	CacheMethodDetails<CacheResult> methodDetails = createMethodDetails(method, ann, cacheName);

	CacheResolver cacheResolver = getCacheResolver(cacheResolverFactory, methodDetails);
	CacheResolver exceptionCacheResolver = null;
	final String exceptionCacheName = ann.exceptionCacheName();
	if (StringUtils.hasText(exceptionCacheName)) {
		exceptionCacheResolver = getExceptionCacheResolver(cacheResolverFactory, methodDetails);
	}

	return new CacheResultOperation(methodDetails, cacheResolver, keyGenerator, exceptionCacheResolver);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:18,代码来源:AnnotationJCacheOperationSource.java

示例2: resolveExceptionCache

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
private Cache resolveExceptionCache(CacheOperationInvocationContext<CacheResultOperation> context) {
	CacheResolver exceptionCacheResolver = context.getOperation().getExceptionCacheResolver();
	if (exceptionCacheResolver != null) {
		return extractFrom(context.getOperation().getExceptionCacheResolver().resolveCaches(context));
	}
	return null;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:CacheResultInterceptor.java

示例3: CachePutOperation

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
public CachePutOperation(
		CacheMethodDetails<CachePut> methodDetails, CacheResolver cacheResolver, KeyGenerator keyGenerator) {

	super(methodDetails, cacheResolver, keyGenerator);
	CachePut ann = methodDetails.getCacheAnnotation();
	this.exceptionTypeFilter = createExceptionTypeFilter(ann.cacheFor(), ann.noCacheFor());
	this.valueParameterDetail = initializeValueParameterDetail(methodDetails.getMethod(), this.allParameterDetails);
	if (this.valueParameterDetail == null) {
		throw new IllegalArgumentException("No parameter annotated with @CacheValue was found for " +
				"" + methodDetails.getMethod());
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:13,代码来源:CachePutOperation.java

示例4: getDefaultCacheResolver

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
@Override
protected CacheResolver getDefaultCacheResolver() {
	if (this.cacheResolver == null) {
		this.cacheResolver = new SimpleCacheResolver(getDefaultCacheManager());
	}
	return this.cacheResolver;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:DefaultJCacheOperationSource.java

示例5: getDefaultExceptionCacheResolver

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
@Override
protected CacheResolver getDefaultExceptionCacheResolver() {
	if (this.exceptionCacheResolver == null) {
		this.exceptionCacheResolver = new LazyCacheResolver();
	}
	return this.exceptionCacheResolver;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:DefaultJCacheOperationSource.java

示例6: AbstractJCacheKeyOperation

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
/**
 * Create a new instance.
 * @param methodDetails the {@link CacheMethodDetails} related to the cached method
 * @param cacheResolver the cache resolver to resolve regular caches
 * @param keyGenerator the key generator to compute cache keys
 */
protected AbstractJCacheKeyOperation(CacheMethodDetails<A> methodDetails,
		CacheResolver cacheResolver, KeyGenerator keyGenerator) {

	super(methodDetails, cacheResolver);
	this.keyGenerator = keyGenerator;
	this.keyParameterDetails = initializeKeyParameterDetails(this.allParameterDetails);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:14,代码来源:AbstractJCacheKeyOperation.java

示例7: CacheRemoveOperation

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
public CacheRemoveOperation(
		CacheMethodDetails<CacheRemove> methodDetails, CacheResolver cacheResolver, KeyGenerator keyGenerator) {

	super(methodDetails, cacheResolver, keyGenerator);
	CacheRemove ann = methodDetails.getCacheAnnotation();
	this.exceptionTypeFilter = createExceptionTypeFilter(ann.evictFor(), ann.noEvictFor());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:8,代码来源:CacheRemoveOperation.java

示例8: createCachePutOperation

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
protected CachePutOperation createCachePutOperation(Method method, CacheDefaults defaults, CachePut ann) {
	String cacheName = determineCacheName(method, defaults, ann.cacheName());
	CacheResolverFactory cacheResolverFactory =
			determineCacheResolverFactory(defaults, ann.cacheResolverFactory());
	KeyGenerator keyGenerator = determineKeyGenerator(defaults, ann.cacheKeyGenerator());

	CacheMethodDetails<CachePut> methodDetails = createMethodDetails(method, ann, cacheName);
	CacheResolver cacheResolver = getCacheResolver(cacheResolverFactory, methodDetails);
	return new CachePutOperation(methodDetails, cacheResolver, keyGenerator);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:AnnotationJCacheOperationSource.java

示例9: createCacheRemoveOperation

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
protected CacheRemoveOperation createCacheRemoveOperation(Method method, CacheDefaults defaults, CacheRemove ann) {
	String cacheName = determineCacheName(method, defaults, ann.cacheName());
	CacheResolverFactory cacheResolverFactory =
			determineCacheResolverFactory(defaults, ann.cacheResolverFactory());
	KeyGenerator keyGenerator = determineKeyGenerator(defaults, ann.cacheKeyGenerator());

	CacheMethodDetails<CacheRemove> methodDetails = createMethodDetails(method, ann, cacheName);
	CacheResolver cacheResolver = getCacheResolver(cacheResolverFactory, methodDetails);
	return new CacheRemoveOperation(methodDetails, cacheResolver, keyGenerator);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:11,代码来源:AnnotationJCacheOperationSource.java

示例10: createCacheRemoveAllOperation

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
protected CacheRemoveAllOperation createCacheRemoveAllOperation(Method method, CacheDefaults defaults, CacheRemoveAll ann) {
	String cacheName = determineCacheName(method, defaults, ann.cacheName());
	CacheResolverFactory cacheResolverFactory =
			determineCacheResolverFactory(defaults, ann.cacheResolverFactory());

	CacheMethodDetails<CacheRemoveAll> methodDetails = createMethodDetails(method, ann, cacheName);
	CacheResolver cacheResolver = getCacheResolver(cacheResolverFactory, methodDetails);
	return new CacheRemoveAllOperation(methodDetails, cacheResolver);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:AnnotationJCacheOperationSource.java

示例11: getCacheResolver

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
protected CacheResolver getCacheResolver(CacheResolverFactory factory, CacheMethodDetails<?> details) {
	if (factory != null) {
		javax.cache.annotation.CacheResolver cacheResolver = factory.getCacheResolver(details);
		return new CacheResolverAdapter(cacheResolver);
	}
	else {
		return getDefaultCacheResolver();
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:AnnotationJCacheOperationSource.java

示例12: getExceptionCacheResolver

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
protected CacheResolver getExceptionCacheResolver(CacheResolverFactory factory,
		CacheMethodDetails<CacheResult> details) {

	if (factory != null) {
		javax.cache.annotation.CacheResolver cacheResolver = factory.getExceptionCacheResolver(details);
		return new CacheResolverAdapter(cacheResolver);
	}
	else {
		return getDefaultExceptionCacheResolver();
	}
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:12,代码来源:AnnotationJCacheOperationSource.java

示例13: AbstractJCacheOperation

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
/**
 * Create a new instance.
 * @param methodDetails the {@link CacheMethodDetails} related to the cached method
 * @param cacheResolver the cache resolver to resolve regular caches
 */
protected AbstractJCacheOperation(CacheMethodDetails<A> methodDetails, CacheResolver cacheResolver) {
	Assert.notNull(methodDetails, "method details must not be null.");
	Assert.notNull(cacheResolver, "cache resolver must not be null.");
	this.methodDetails = methodDetails;
	this.cacheResolver = cacheResolver;
	this.allParameterDetails = initializeAllParameterDetails(methodDetails.getMethod());
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:13,代码来源:AbstractJCacheOperation.java

示例14: CacheResultOperation

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
public CacheResultOperation(CacheMethodDetails<CacheResult> methodDetails, CacheResolver cacheResolver,
		KeyGenerator keyGenerator, CacheResolver exceptionCacheResolver) {

	super(methodDetails, cacheResolver, keyGenerator);
	CacheResult ann = methodDetails.getCacheAnnotation();
	this.exceptionTypeFilter = createExceptionTypeFilter(ann.cachedExceptions(), ann.nonCachedExceptions());
	this.exceptionCacheResolver = exceptionCacheResolver;
	this.exceptionCacheName = (StringUtils.hasText(ann.exceptionCacheName()) ? ann.exceptionCacheName() : null);
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:10,代码来源:CacheResultOperation.java

示例15: createOperationSource

import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
protected JCacheOperationSource createOperationSource(CacheManager cacheManager,
		CacheResolver cacheResolver, CacheResolver exceptionCacheResolver, KeyGenerator keyGenerator) {

	DefaultJCacheOperationSource source = new DefaultJCacheOperationSource();
	source.setCacheManager(cacheManager);
	source.setCacheResolver(cacheResolver);
	source.setExceptionCacheResolver(exceptionCacheResolver);
	source.setKeyGenerator(keyGenerator);
	source.setBeanFactory(new StaticListableBeanFactory());
	source.afterPropertiesSet();
	source.afterSingletonsInstantiated();
	return source;
}
 
开发者ID:langtianya,项目名称:spring4-understanding,代码行数:14,代码来源:JCacheInterceptorTests.java


注:本文中的org.springframework.cache.interceptor.CacheResolver类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。