public class CompositeCacheManager extends Object implements org.springframework.beans.factory.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() |
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()
afterPropertiesSet
in interface org.springframework.beans.factory.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