本文整理汇总了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);
}
示例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;
}
示例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());
}
}
示例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;
}
示例5: getDefaultExceptionCacheResolver
import org.springframework.cache.interceptor.CacheResolver; //导入依赖的package包/类
@Override
protected CacheResolver getDefaultExceptionCacheResolver() {
if (this.exceptionCacheResolver == null) {
this.exceptionCacheResolver = new LazyCacheResolver();
}
return this.exceptionCacheResolver;
}
示例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);
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
}
示例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();
}
}
示例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());
}
示例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);
}
示例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;
}