Search in sources :

Example 1 with CacheResolverFactory

use of javax.cache.annotation.CacheResolverFactory in project spring-framework by spring-projects.

the class AnnotationJCacheOperationSource method createCacheResultOperation.

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);
}
Also used : CacheResult(javax.cache.annotation.CacheResult) CacheResolver(org.springframework.cache.interceptor.CacheResolver) KeyGenerator(org.springframework.cache.interceptor.KeyGenerator) CacheKeyGenerator(javax.cache.annotation.CacheKeyGenerator) CacheResolverFactory(javax.cache.annotation.CacheResolverFactory)

Example 2 with CacheResolverFactory

use of javax.cache.annotation.CacheResolverFactory in project spring-framework by spring-projects.

the class AnnotationJCacheOperationSource method createCacheRemoveOperation.

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);
}
Also used : CacheRemove(javax.cache.annotation.CacheRemove) CacheResolver(org.springframework.cache.interceptor.CacheResolver) KeyGenerator(org.springframework.cache.interceptor.KeyGenerator) CacheKeyGenerator(javax.cache.annotation.CacheKeyGenerator) CacheResolverFactory(javax.cache.annotation.CacheResolverFactory)

Example 3 with CacheResolverFactory

use of javax.cache.annotation.CacheResolverFactory in project spring-framework by spring-projects.

the class AnnotationJCacheOperationSource method createCacheRemoveAllOperation.

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);
}
Also used : CacheResolver(org.springframework.cache.interceptor.CacheResolver) CacheRemoveAll(javax.cache.annotation.CacheRemoveAll) CacheResolverFactory(javax.cache.annotation.CacheResolverFactory)

Example 4 with CacheResolverFactory

use of javax.cache.annotation.CacheResolverFactory in project spring-framework by spring-projects.

the class AnnotationJCacheOperationSource method createCachePutOperation.

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);
}
Also used : CacheResolver(org.springframework.cache.interceptor.CacheResolver) KeyGenerator(org.springframework.cache.interceptor.KeyGenerator) CacheKeyGenerator(javax.cache.annotation.CacheKeyGenerator) CachePut(javax.cache.annotation.CachePut) CacheResolverFactory(javax.cache.annotation.CacheResolverFactory)

Aggregations

CacheResolverFactory (javax.cache.annotation.CacheResolverFactory)4 CacheResolver (org.springframework.cache.interceptor.CacheResolver)4 CacheKeyGenerator (javax.cache.annotation.CacheKeyGenerator)3 KeyGenerator (org.springframework.cache.interceptor.KeyGenerator)3 CachePut (javax.cache.annotation.CachePut)1 CacheRemove (javax.cache.annotation.CacheRemove)1 CacheRemoveAll (javax.cache.annotation.CacheRemoveAll)1 CacheResult (javax.cache.annotation.CacheResult)1