Top Description Fields Constructors Methods
org.springframework.cache.support

public Class NoOpCacheManager

extends Object
implements CacheManager
Class Inheritance
All Implemented Interfaces
org.springframework.cache.CacheManager
Imports
java.util.Collection, .Collections, .LinkedHashSet, .Set, java.util.concurrent.ConcurrentHashMap, .ConcurrentMap, org.springframework.cache.Cache, .CacheManager, org.springframework.lang.Nullable

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.

Authors
Costin Leau, Stephane Nicoll
Since
3.1
See Also
NoOpCache

Field Summary

Modifier and TypeField and Description
private final Set<String>
private final ConcurrentMap<String, Cache>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public Cache
getCache(String
the cache identifier (must not be null)
name
)

Implements org.springframework.cache.CacheManager.getCache.

This implementation always returns a Cache implementation that will not store items.

public Collection<String>
getCacheNames()

Implements org.springframework.cache.CacheManager.getCacheNames.

This implementation returns the name of the caches previously requested.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cacheNamesback to summary
private final Set<String> cacheNames
cachesback to summary
private final ConcurrentMap<String, Cache> caches

Constructor Detail

NoOpCacheManagerback to summary
public NoOpCacheManager()

Method Detail

getCacheback to summary
public Cache getCache(String name)

Implements org.springframework.cache.CacheManager.getCache.

This implementation always returns a Cache implementation that will not store items. Additionally, the request cache will be remembered by the manager for consistency.

Parameters
name:String

Doc from org.springframework.cache.CacheManager.getCache.

the cache identifier (must not be null)

Returns:Cache

Doc from org.springframework.cache.CacheManager.getCache.

the associated cache, or null if such a cache does not exist or could be not created

Annotations
@Override
@Nullable
getCacheNamesback to summary
public Collection<String> getCacheNames()

Implements org.springframework.cache.CacheManager.getCacheNames.

This implementation returns the name of the caches previously requested.

Returns:Collection<String>

Doc from org.springframework.cache.CacheManager.getCacheNames.

the names of all caches known by the cache manager

Annotations
@Override