public class CompositeCacheManager extends Object implements InitializingBean, CacheManager
CacheManager
implementation that iterates
over a given collection of CacheManager
instances.
Allows NoOpCacheManager
to be automatically added to the list for handling
the cache declarations without a backing store.Constructor and Description |
---|
CompositeCacheManager() |
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).
|
Cache |
getCache(String name)
Return the cache associated with the given name.
|
Collection<String> |
getCacheNames()
Return a collection of the caches known by this cache manager.
|
void |
setCacheManagers(Collection<CacheManager> cacheManagers) |
void |
setFallbackToNoOpCache(boolean fallbackToNoOpCache)
Indicate whether a
NoOpCacheManager should be added at the end of the manager lists. |
public void setCacheManagers(Collection<CacheManager> cacheManagers)
public void setFallbackToNoOpCache(boolean fallbackToNoOpCache)
NoOpCacheManager
should be added at the end of the manager lists.
In this case, any getCache
requests not handled by the configured cache managers will
be automatically handled by the NoOpCacheManager
(and hence never return null
).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
public Cache getCache(String name)
CacheManager
getCache
in interface CacheManager
name
- cache identifier (must not be null
)null
if none is foundpublic Collection<String> getCacheNames()
CacheManager
getCacheNames
in interface CacheManager