Class JCacheCacheManager
- All Implemented Interfaces:
InitializingBean, CacheManager
CacheManager implementation
backed by a JCache javax.cache.CacheManager.- Since:
- 3.2
- Author:
- Juergen Hoeller, Stephane Nicoll
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCreate a newJCacheCacheManagerwithout a backing JCachejavax.cache.CacheManager.JCacheCacheManager(javax.cache.CacheManager cacheManager) Create a newJCacheCacheManagerfor the given backing JCachejavax.cache.CacheManager. -
Method Summary
Modifier and TypeMethodDescriptionvoidInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.@Nullable javax.cache.CacheManagerReturn the backing JCachejavax.cache.CacheManager.getMissingCache(String name) Return a missing cache with the specifiedname, ornullif such a cache does not exist or could not be created on demand.booleanReturn whether this cache manager accepts and convertsnullvalues for all of its caches.protected Collection<Cache> Load the initial caches for this cache manager.voidRemove all registered caches from this cache manager if possible, re-creating them on demand.voidsetAllowNullValues(boolean allowNullValues) Specify whether to accept and convertnullvalues for all caches in this cache manager.voidsetCacheManager(@Nullable javax.cache.CacheManager cacheManager) Set the backing JCachejavax.cache.CacheManager.Methods inherited from class AbstractTransactionSupportingCacheManager
decorateCache, isTransactionAware, setTransactionAwareMethods inherited from class AbstractCacheManager
getCache, getCacheNames, initializeCaches, lookupCache
-
Constructor Details
-
JCacheCacheManager
public JCacheCacheManager()Create a newJCacheCacheManagerwithout a backing JCachejavax.cache.CacheManager.The backing JCache
javax.cache.CacheManagercan be set via thesetCacheManager(CacheManager)bean property. -
JCacheCacheManager
public JCacheCacheManager(javax.cache.CacheManager cacheManager) Create a newJCacheCacheManagerfor the given backing JCachejavax.cache.CacheManager.- Parameters:
cacheManager- the backing JCachejavax.cache.CacheManager
-
-
Method Details
-
setCacheManager
Set the backing JCachejavax.cache.CacheManager. -
getCacheManager
Return the backing JCachejavax.cache.CacheManager. -
setAllowNullValues
public void setAllowNullValues(boolean allowNullValues) Specify whether to accept and convertnullvalues for all caches in this cache manager.Default is "true", despite JSR-107 itself not supporting
nullvalues. An internal holder object will be used to store user-levelnulls. -
isAllowNullValues
public boolean isAllowNullValues()Return whether this cache manager accepts and convertsnullvalues for all of its caches. -
afterPropertiesSet
public void afterPropertiesSet()Description copied from interface:InitializingBeanInvoked by the containingBeanFactoryafter it has set all bean properties and satisfiedBeanFactoryAware,ApplicationContextAwareetc.This method allows the bean instance to perform validation of its overall configuration and final initialization when all bean properties have been set.
- Specified by:
afterPropertiesSetin interfaceInitializingBean- Overrides:
afterPropertiesSetin classAbstractCacheManager
-
loadCaches
Description copied from class:AbstractCacheManagerLoad the initial caches for this cache manager.Called by
AbstractCacheManager.afterPropertiesSet()on startup. The returned collection may be empty but must not benull.- Specified by:
loadCachesin classAbstractCacheManager
-
getMissingCache
Description copied from class:AbstractCacheManagerReturn a missing cache with the specifiedname, ornullif such a cache does not exist or could not be created on demand.Caches may be lazily created at runtime if the native provider supports it. If a lookup by name does not yield any result, an
AbstractCacheManagersubclass gets a chance to register such a cache at runtime. The returned cache will be automatically added to this cache manager.- Overrides:
getMissingCachein classAbstractCacheManager- Parameters:
name- the name of the cache to retrieve- Returns:
- the missing cache, or
nullif no such cache exists or could be created on demand - See Also:
-
resetCaches
public void resetCaches()Description copied from interface:CacheManagerRemove all registered caches from this cache manager if possible, re-creating them on demand. After this call,CacheManager.getCacheNames()will possibly be empty and the cache provider will have dropped all cache management state.Alternatively, an implementation may perform an equivalent reset on fixed existing cache regions without actually dropping the cache. This behavior will be indicated by
CacheManager.getCacheNames()still exposing a non-empty set of names, whereas the corresponding cache regions will not contain cache entries anymore.The default implementation calls
Cache.clear()on all registered caches, retaining all caches as registered, satisfying the alternative implementation path above. Custom implementations may either drop the actual caches (re-creating them on demand) or perform a more exhaustive reset at the actual cache provider level.- Specified by:
resetCachesin interfaceCacheManager- Overrides:
resetCachesin classAbstractCacheManager- See Also:
-