org.springframework.cache.support

Class NoOpCacheManager

  • java.lang.Object
    • 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, Stephane Nicoll
    See Also:
    CompositeCacheManager
    • Constructor Summary

      Constructors 
      Constructor and Description
      NoOpCacheManager() 
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      Cache getCache(java.lang.String name)
      This implementation always returns a Cache implementation that will not store items.
      java.util.Collection<java.lang.String> getCacheNames()
      This implementation returns the name of the caches previously requested.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NoOpCacheManager

        public NoOpCacheManager()
    • Method Detail

      • getCache

        @Nullable
        public Cache getCache(java.lang.String name)
        This implementation always returns a Cache 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 - the cache identifier (must not be null)
        Returns:
        the associated cache, or null if none found
      • getCacheNames

        public java.util.Collection<java.lang.String> getCacheNames()
        This implementation returns the name of the caches previously requested.
        Specified by:
        getCacheNames in interface CacheManager
        Returns:
        the names of all caches known by the cache manager