org.springframework.cache.support
Class NoOpCacheManager

java.lang.Object
  extended by org.springframework.cache.support.NoOpCacheManager
All Implemented Interfaces:
CacheManager

public class NoOpCacheManager
extends java.lang.Object
implements CacheManager

A basic, no operation CacheManager implementation suitable for disabling caching, typically used for backing cache declarations without an actual backing store.

Will simply accept any items into the cache not actually storing them.

Since:
3.1
Author:
Costin Leau
See Also:
CompositeCacheManager

Nested Class Summary
private static class NoOpCacheManager.NoOpCache
           
 
Field Summary
private  java.util.concurrent.ConcurrentMap<java.lang.String,Cache> caches
           
private  java.util.Set<java.lang.String> names
           
 
Constructor Summary
NoOpCacheManager()
           
 
Method Summary
 Cache getCache(java.lang.String name)
          Return the cache associated with the given name.
 java.util.Collection<java.lang.String> getCacheNames()
          Return a collection of the caches known by this cache manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

caches

private final java.util.concurrent.ConcurrentMap<java.lang.String,Cache> caches

names

private java.util.Set<java.lang.String> names
Constructor Detail

NoOpCacheManager

public NoOpCacheManager()
Method Detail

getCache

public Cache getCache(java.lang.String name)
Return the cache associated with the given name. This implementation always returns a NoOpCacheManager.NoOpCache implementation that will not store items. Additionally, the request cache will be remembered by the manager for consistency.

Specified by:
getCache in interface CacheManager
Parameters:
name - cache identifier (must not be null)
Returns:
associated cache, or null if none is found

getCacheNames

public java.util.Collection<java.lang.String> getCacheNames()
Return a collection of the caches known by this cache manager. This implementation returns the name of the caches previously requested.

Specified by:
getCacheNames in interface CacheManager
Returns:
names of caches known by the cache manager.