Top Description Fields Constructors Methods
org.springframework.cache.jcache

public Class JCacheCacheManager

extends AbstractTransactionSupportingCacheManager
Class Inheritance
Imports
java.util.Collection, .LinkedHashSet, javax.cache.CacheManager, .Caching, org.springframework.cache.Cache, org.springframework.cache.transaction.AbstractTransactionSupportingCacheManager, org.springframework.lang.Nullable, org.springframework.util.Assert

org.springframework.cache.CacheManager implementation backed by a JCache javax.cache.CacheManager.

Note

This class has been updated for JCache 1.0, as of Spring 4.0.

Authors
Juergen Hoeller, Stephane Nicoll
Since
3.2
See Also
JCacheCache

Field Summary

Modifier and TypeField and Description
private boolean
private CacheManager

Constructor Summary

AccessConstructor and Description
public
JCacheCacheManager()

Create a new JCacheCacheManager without a backing JCache javax.cache.CacheManager.

public
JCacheCacheManager(CacheManager
the backing JCache javax.cache.CacheManager
cacheManager
)

Create a new JCacheCacheManager for the given backing JCache javax.cache.CacheManager.

Method Summary

Modifier and TypeMethod and Description
public void
afterPropertiesSet()

Overrides org.springframework.cache.support.AbstractCacheManager.afterPropertiesSet.

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, 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.

public CacheManager
getCacheManager()

Return the backing JCache javax.cache.CacheManager.

protected Cache
getMissingCache(String
the name of the cache to retrieve
name
)

Overrides org.springframework.cache.support.AbstractCacheManager.getMissingCache.

Return a missing cache with the specified name, or null if such a cache does not exist or could not be created on demand.

public boolean
isAllowNullValues()

Return whether this cache manager accepts and converts null values for all of its caches.

protected Collection<Cache>
loadCaches()

Implements abstract org.springframework.cache.support.AbstractCacheManager.loadCaches.

Load the initial caches for this cache manager.

public void
setAllowNullValues(boolean allowNullValues)

Specify whether to accept and convert null values for all caches in this cache manager.

public void
setCacheManager(CacheManager cacheManager)

Set the backing JCache javax.cache.CacheManager.

Inherited from org.springframework.cache.transaction.AbstractTransactionSupportingCacheManager:
decorateCacheisTransactionAwaresetTransactionAware

Field Detail

allowNullValuesback to summary
private boolean allowNullValues
cacheManagerback to summary
private CacheManager cacheManager
Annotations
@Nullable

Constructor Detail

JCacheCacheManagerback to summary
public JCacheCacheManager()

Create a new JCacheCacheManager without a backing JCache javax.cache.CacheManager.

The backing JCache javax.cache.CacheManager can be set via the setCacheManager bean property.

JCacheCacheManagerback to summary
public JCacheCacheManager(CacheManager cacheManager)

Create a new JCacheCacheManager for the given backing JCache javax.cache.CacheManager.

Parameters
cacheManager:CacheManager

the backing JCache javax.cache.CacheManager

Method Detail

afterPropertiesSetback to summary
public void afterPropertiesSet()

Overrides org.springframework.cache.support.AbstractCacheManager.afterPropertiesSet.

Implements org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Doc from org.springframework.beans.factory.InitializingBean.afterPropertiesSet.

Invoked by the containing BeanFactory after it has set all bean properties and satisfied BeanFactoryAware, 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.

Annotations
@Override
getCacheManagerback to summary
public CacheManager getCacheManager()

Return the backing JCache javax.cache.CacheManager.

Annotations
@Nullable
getMissingCacheback to summary
protected Cache getMissingCache(String name)

Overrides org.springframework.cache.support.AbstractCacheManager.getMissingCache.

Doc from org.springframework.cache.support.AbstractCacheManager.getMissingCache.

Return a missing cache with the specified name, or null 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.

Parameters
name:String

the name of the cache to retrieve

Returns:Cache

the missing cache, or null if no such cache exists or could be created on demand

Annotations
@Override
isAllowNullValuesback to summary
public boolean isAllowNullValues()

Return whether this cache manager accepts and converts null values for all of its caches.

loadCachesback to summary
protected Collection<Cache> loadCaches()

Implements abstract org.springframework.cache.support.AbstractCacheManager.loadCaches.

Doc from org.springframework.cache.support.AbstractCacheManager.loadCaches.

Load the initial caches for this cache manager.

Called by afterPropertiesSet() on startup. The returned collection may be empty but must not be null.

Annotations
@Override
setAllowNullValuesback to summary
public void setAllowNullValues(boolean allowNullValues)

Specify whether to accept and convert 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 nulls.

setCacheManagerback to summary
public void setCacheManager(CacheManager cacheManager)

Set the backing JCache javax.cache.CacheManager.