Class NoOpCacheManager
- All Implemented Interfaces:
CacheManager
CacheManager implementation suitable
for disabling caching, typically used for backing cache declarations
without an actual backing store.
This implementation will simply accept any items into the cache, not actually storing them.
- Since:
- 3.1
- Author:
- Costin Leau, Stephane Nicoll, Juergen Hoeller
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet the cache associated with the given name.Get a collection of the cache names known by this manager.voidRemove all registered caches from this cache manager if possible, re-creating them on demand.
-
Constructor Details
-
NoOpCacheManager
public NoOpCacheManager()
-
-
Method Details
-
getCache
Description copied from interface:CacheManagerGet the cache associated with the given name.Note that the cache may be lazily created at runtime if the native provider supports it.
- Specified by:
getCachein interfaceCacheManager- Parameters:
name- the cache identifier (must not benull)- Returns:
- the associated cache, or
nullif such a cache does not exist or could be not created
-
getCacheNames
Description copied from interface:CacheManagerGet a collection of the cache names known by this manager.- Specified by:
getCacheNamesin interfaceCacheManager- Returns:
- the names of all caches known by the cache manager
-
resetCaches
public void resetCaches()Description copied from interface:CacheManagerRemove all registered caches from this cache manager if possible, re-creating them on demand. After this call,CacheManager.getCacheNames()will possibly be empty and the cache provider will have dropped all cache management state.Alternatively, an implementation may perform an equivalent reset on fixed existing cache regions without actually dropping the cache. This behavior will be indicated by
CacheManager.getCacheNames()still exposing a non-empty set of names, whereas the corresponding cache regions will not contain cache entries anymore.The default implementation calls
Cache.clear()on all registered caches, retaining all caches as registered, satisfying the alternative implementation path above. Custom implementations may either drop the actual caches (re-creating them on demand) or perform a more exhaustive reset at the actual cache provider level.- Specified by:
resetCachesin interfaceCacheManager- See Also:
-