public class DefaultJCacheOperationSource extends AnnotationJCacheOperationSource implements org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.SmartInitializingSingleton
JCacheOperationSource implementation delegating
default operations to configurable services with sensible defaults
when not present.logger| Constructor and Description |
|---|
DefaultJCacheOperationSource()
Construct a new
DefaultJCacheOperationSource with the default key generator. |
DefaultJCacheOperationSource(Supplier<org.springframework.cache.CacheManager> cacheManager,
Supplier<org.springframework.cache.interceptor.CacheResolver> cacheResolver,
Supplier<org.springframework.cache.interceptor.CacheResolver> exceptionCacheResolver,
Supplier<org.springframework.cache.interceptor.KeyGenerator> keyGenerator)
Construct a new
DefaultJCacheOperationSource with the given cache manager,
cache resolver and key generator suppliers, applying the corresponding default
if a supplier is not resolvable. |
| Modifier and Type | Method and Description |
|---|---|
void |
afterSingletonsInstantiated() |
protected <T> T |
getBean(Class<T> type)
Locate or create an instance of the specified cache strategy
type. |
org.springframework.cache.CacheManager |
getCacheManager()
Return the specified cache manager to use, if any.
|
org.springframework.cache.interceptor.CacheResolver |
getCacheResolver()
Return the specified cache resolver to use, if any.
|
protected org.springframework.cache.CacheManager |
getDefaultCacheManager() |
protected org.springframework.cache.interceptor.CacheResolver |
getDefaultCacheResolver()
Return the default
CacheResolver if none is set. |
protected org.springframework.cache.interceptor.CacheResolver |
getDefaultExceptionCacheResolver()
Return the default exception
CacheResolver if none is set. |
protected org.springframework.cache.interceptor.KeyGenerator |
getDefaultKeyGenerator()
Return the default
KeyGenerator if none is set. |
org.springframework.cache.interceptor.CacheResolver |
getExceptionCacheResolver()
Return the specified exception cache resolver to use, if any.
|
org.springframework.cache.interceptor.KeyGenerator |
getKeyGenerator()
Return the specified key generator to use.
|
void |
setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory) |
void |
setCacheManager(org.springframework.cache.CacheManager cacheManager)
Set the default
CacheManager to use to lookup cache by name. |
void |
setCacheResolver(org.springframework.cache.interceptor.CacheResolver cacheResolver)
Set the
CacheResolver to resolve regular caches. |
void |
setExceptionCacheResolver(org.springframework.cache.interceptor.CacheResolver exceptionCacheResolver)
Set the
CacheResolver to resolve exception caches. |
void |
setKeyGenerator(org.springframework.cache.interceptor.KeyGenerator keyGenerator)
Set the default
KeyGenerator. |
createCachePutOperation, createCacheRemoveAllOperation, createCacheRemoveOperation, createCacheResultOperation, determineCacheName, determineCacheResolverFactory, determineKeyGenerator, findCacheOperation, generateDefaultCacheName, getCacheDefaults, getCacheResolver, getExceptionCacheResolverallowPublicMethodsOnly, getCacheOperationpublic DefaultJCacheOperationSource()
DefaultJCacheOperationSource with the default key generator.SimpleKeyGeneratorpublic DefaultJCacheOperationSource(@Nullable
Supplier<org.springframework.cache.CacheManager> cacheManager,
@Nullable
Supplier<org.springframework.cache.interceptor.CacheResolver> cacheResolver,
@Nullable
Supplier<org.springframework.cache.interceptor.CacheResolver> exceptionCacheResolver,
@Nullable
Supplier<org.springframework.cache.interceptor.KeyGenerator> keyGenerator)
DefaultJCacheOperationSource with the given cache manager,
cache resolver and key generator suppliers, applying the corresponding default
if a supplier is not resolvable.public void setCacheManager(@Nullable
org.springframework.cache.CacheManager cacheManager)
CacheManager to use to lookup cache by name.
Only mandatory if the cache resolver has not been set.@Nullable public org.springframework.cache.CacheManager getCacheManager()
public void setCacheResolver(@Nullable
org.springframework.cache.interceptor.CacheResolver cacheResolver)
CacheResolver to resolve regular caches. If none is set, a default
implementation using the specified cache manager will be used.@Nullable public org.springframework.cache.interceptor.CacheResolver getCacheResolver()
public void setExceptionCacheResolver(@Nullable
org.springframework.cache.interceptor.CacheResolver exceptionCacheResolver)
CacheResolver to resolve exception caches. If none is set, a default
implementation using the specified cache manager will be used.@Nullable public org.springframework.cache.interceptor.CacheResolver getExceptionCacheResolver()
public void setKeyGenerator(org.springframework.cache.interceptor.KeyGenerator keyGenerator)
KeyGenerator. If none is set, a SimpleKeyGenerator
honoring the JSR-107 CacheKey and
CacheValue will be used.public org.springframework.cache.interceptor.KeyGenerator getKeyGenerator()
public void setBeanFactory(org.springframework.beans.factory.BeanFactory beanFactory)
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAwarepublic void afterSingletonsInstantiated()
afterSingletonsInstantiated in interface org.springframework.beans.factory.SmartInitializingSingletonprotected <T> T getBean(Class<T> type)
AnnotationJCacheOperationSourcetype.getBean in class AnnotationJCacheOperationSourcetype - the type of the bean to manageprotected org.springframework.cache.CacheManager getDefaultCacheManager()
protected org.springframework.cache.interceptor.CacheResolver getDefaultCacheResolver()
AnnotationJCacheOperationSourceCacheResolver if none is set.getDefaultCacheResolver in class AnnotationJCacheOperationSourceprotected org.springframework.cache.interceptor.CacheResolver getDefaultExceptionCacheResolver()
AnnotationJCacheOperationSourceCacheResolver if none is set.getDefaultExceptionCacheResolver in class AnnotationJCacheOperationSourceprotected org.springframework.cache.interceptor.KeyGenerator getDefaultKeyGenerator()
AnnotationJCacheOperationSourceKeyGenerator if none is set.getDefaultKeyGenerator in class AnnotationJCacheOperationSource