Class EhCacheCacheManager
- java.lang.Object
- org.springframework.cache.support.AbstractCacheManager
- org.springframework.cache.transaction.AbstractTransactionSupportingCacheManager
- org.springframework.cache.ehcache.EhCacheCacheManager
- All Implemented Interfaces:
InitializingBean
,CacheManager
public class EhCacheCacheManager extends AbstractTransactionSupportingCacheManager
CacheManager backed by an EhCacheCacheManager
.- Since:
- 3.1
- Author:
- Costin Leau, Juergen Hoeller, Stephane Nicoll
- See Also:
EhCacheCache
Constructor Summary
Constructors Constructor Description EhCacheCacheManager()
Create a new EhCacheCacheManager, setting the target EhCache CacheManager through thesetCacheManager(net.sf.ehcache.CacheManager)
bean property.EhCacheCacheManager(CacheManager cacheManager)
Create a new EhCacheCacheManager for the given backing EhCache CacheManager.
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
afterPropertiesSet()
Invoked by the containingBeanFactory
after it has set all bean properties and satisfiedBeanFactoryAware
,ApplicationContextAware
etc.CacheManager
getCacheManager()
Return the backing EhCacheCacheManager
.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.protected Collection<Cache>
loadCaches()
Load the initial caches for this cache manager.void
setCacheManager(CacheManager cacheManager)
Set the backing EhCacheCacheManager
.Methods inherited from class org.springframework.cache.transaction.AbstractTransactionSupportingCacheManager
decorateCache, isTransactionAware, setTransactionAware
Methods inherited from class org.springframework.cache.support.AbstractCacheManager
addCache, getCache, getCacheNames, initializeCaches, lookupCache
Constructor Detail
EhCacheCacheManager
public EhCacheCacheManager()
Create a new EhCacheCacheManager, setting the target EhCache CacheManager through thesetCacheManager(net.sf.ehcache.CacheManager)
bean property.
EhCacheCacheManager
public EhCacheCacheManager(CacheManager cacheManager)
Create a new EhCacheCacheManager for the given backing EhCache CacheManager.- Parameters:
cacheManager
- the backing EhCacheCacheManager
Method Detail
setCacheManager
public void setCacheManager(@Nullable CacheManager cacheManager)
Set the backing EhCacheCacheManager
.
getCacheManager
@Nullable public CacheManager getCacheManager()
Return the backing EhCacheCacheManager
.
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
protected Collection<Cache> 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
protected Cache getMissingCache(String name)
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:
AbstractCacheManager.getCache(String)