public class JCacheCacheManager extends AbstractTransactionSupportingCacheManager
CacheManager
implementation
backed by a JCache CacheManager
.
Note: This class has been updated for JCache 1.0, as of Spring 4.0.
Constructor and Description |
---|
JCacheCacheManager()
Create a new JCacheCacheManager, setting the target JCache CacheManager
through the
setCacheManager(javax.cache.CacheManager) bean property. |
JCacheCacheManager(javax.cache.CacheManager cacheManager)
Create a new JCacheCacheManager for the given backing JCache.
|
Modifier and Type | Method and Description |
---|---|
void |
afterPropertiesSet()
Invoked by a BeanFactory after it has set all bean properties supplied
(and satisfied BeanFactoryAware and ApplicationContextAware).
|
javax.cache.CacheManager |
getCacheManager()
Return the backing JCache
CacheManager . |
protected Cache |
getMissingCache(String name)
Return a missing cache with the specified
name or null if
such cache does not exist or could not be created on the fly. |
boolean |
isAllowNullValues()
Return whether this cache manager accepts and converts
null values
for all of its caches. |
protected Collection<Cache> |
loadCaches()
Load the initial caches for this cache manager.
|
void |
setAllowNullValues(boolean allowNullValues)
Specify whether to accept and convert
null values for all caches
in this cache manager. |
void |
setCacheManager(javax.cache.CacheManager cacheManager)
Set the backing JCache
CacheManager . |
decorateCache, isTransactionAware, setTransactionAware
addCache, getCache, getCacheNames, initializeCaches, lookupCache
public JCacheCacheManager()
setCacheManager(javax.cache.CacheManager)
bean property.public JCacheCacheManager(javax.cache.CacheManager cacheManager)
cacheManager
- the backing JCache CacheManager
public void setCacheManager(javax.cache.CacheManager cacheManager)
CacheManager
.public javax.cache.CacheManager getCacheManager()
CacheManager
.public void setAllowNullValues(boolean allowNullValues)
null
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-level null
s.
public boolean isAllowNullValues()
null
values
for all of its caches.public void afterPropertiesSet()
InitializingBean
This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.
afterPropertiesSet
in interface InitializingBean
afterPropertiesSet
in class AbstractCacheManager
protected Collection<Cache> loadCaches()
AbstractCacheManager
Called by AbstractCacheManager.afterPropertiesSet()
on startup.
The returned collection may be empty but must not be null
.
loadCaches
in class AbstractCacheManager
protected Cache getMissingCache(String name)
AbstractCacheManager
name
or null
if
such cache does not exist or could not be created on the fly.
Some caches may be created at runtime if the native provider supports it. If a lookup by name does not yield any result, a subclass gets a chance to register such a cache at runtime. The returned cache will be automatically added to this instance.
getMissingCache
in class AbstractCacheManager
name
- the name of the cache to retrievenull
if no such cache exists or could be
createdAbstractCacheManager.getCache(String)