Class JCacheCacheManager
- All Implemented Interfaces:
InitializingBean
,CacheManager
CacheManager
implementation
backed by a JCache javax.cache.CacheManager
.
Note: This class has been updated for JCache 1.0, as of Spring 4.0.
- Since:
- 3.2
- Author:
- Juergen Hoeller, Stephane Nicoll
- See Also:
-
Constructor Summary
ConstructorDescriptionCreate a newJCacheCacheManager
without a backing JCachejavax.cache.CacheManager
.JCacheCacheManager
(javax.cache.CacheManager cacheManager) Create a newJCacheCacheManager
for the given backing JCachejavax.cache.CacheManager
. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.javax.cache.CacheManager
Return the backing JCachejavax.cache.CacheManager
.protected Cache
getMissingCache
(String name) Return a missing cache with the specifiedname
, ornull
if such a cache does not exist or could not be created on demand.boolean
Return whether this cache manager accepts and convertsnull
values for all of its caches.protected Collection<Cache>
Load the initial caches for this cache manager.void
setAllowNullValues
(boolean allowNullValues) Specify whether to accept and convertnull
values for all caches in this cache manager.void
setCacheManager
(javax.cache.CacheManager cacheManager) Set the backing JCachejavax.cache.CacheManager
.Methods inherited from class org.springframework.cache.transaction.AbstractTransactionSupportingCacheManager
decorateCache, isTransactionAware, setTransactionAware
Methods inherited from class org.springframework.cache.support.AbstractCacheManager
getCache, getCacheNames, initializeCaches, lookupCache
-
Constructor Details
-
JCacheCacheManager
public JCacheCacheManager()Create a newJCacheCacheManager
without a backing JCachejavax.cache.CacheManager
.The backing JCache
javax.cache.CacheManager
can be set via thesetCacheManager(javax.cache.CacheManager)
bean property. -
JCacheCacheManager
public JCacheCacheManager(javax.cache.CacheManager cacheManager) Create a newJCacheCacheManager
for 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 convertnull
values for all caches in this cache manager.Default is "true", despite JSR-107 itself not supporting
null
values. An internal holder object will be used to store user-levelnull
s. -
isAllowNullValues
public boolean isAllowNullValues()Return whether this cache manager accepts and convertsnull
values for all of its caches. -
afterPropertiesSet
public void afterPropertiesSet()Description copied from interface:InitializingBean
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.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:
afterPropertiesSet
in interfaceInitializingBean
- Overrides:
afterPropertiesSet
in classAbstractCacheManager
-
loadCaches
Description copied from class:AbstractCacheManager
Load 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:
loadCaches
in classAbstractCacheManager
-
getMissingCache
Description copied from class:AbstractCacheManager
Return a missing cache with the specifiedname
, ornull
if 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
AbstractCacheManager
subclass gets a chance to register such a cache at runtime. The returned cache will be automatically added to this cache manager.- Overrides:
getMissingCache
in classAbstractCacheManager
- Parameters:
name
- the name of the cache to retrieve- Returns:
- the missing cache, or
null
if no such cache exists or could be created on demand - See Also:
-