ConcurrentMapCacheManager (Spring Framework 3.2.1.RELEASE API)
Date: 2013-01-24

org.springframework.cache.concurrent

## Class ConcurrentMapCacheManager

- java.lang.Object
- - org.springframework.cache.concurrent.ConcurrentMapCacheManager

- All Implemented Interfaces:
    CacheManager

      public class ConcurrentMapCacheManager
      extends Object
      implements CacheManager

  `CacheManager` implementation that lazily builds `ConcurrentMapCache` instances for each `getCache(java.lang.String)` request. Also supports a 'static' mode where the set of cache names is pre-defined through `setCacheNames(java.util.Collection<java.lang.String>)`, with no dynamic creation of further cache regions at runtime.
  Since:
    3.1
  Author:
    Juergen Hoeller

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ConcurrentMapCacheManager()` Construct a dynamic ConcurrentMapCacheManager, lazily creating cache instances as they are being requested.
    `ConcurrentMapCacheManager(String... cacheNames)` Construct a static ConcurrentMapCacheManager, managing caches for the specified cache names only.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Cache` | `createConcurrentMapCache(String name)` Create a new ConcurrentMapCache instance for the specified cache name.
    `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` | `setCacheNames(Collection<String> cacheNames)` Specify the set of cache names for this CacheManager's 'static' mode.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ConcurrentMapCacheManager

          public ConcurrentMapCacheManager()

      Construct a dynamic ConcurrentMapCacheManager, lazily creating cache instances as they are being requested.

    - #### ConcurrentMapCacheManager

          public ConcurrentMapCacheManager(String... cacheNames)

      Construct a static ConcurrentMapCacheManager, managing caches for the specified cache names only.

  - ### Method Detail

    - #### setCacheNames

          public void setCacheNames(Collection<String> cacheNames)

      Specify the set of cache names for this CacheManager's 'static' mode.

      The number of caches and their names will be fixed after a call to this method, with no creation of further cache regions at runtime.

    - #### getCacheNames

          public Collection<String> getCacheNames()

      Description copied from interface: `CacheManager`
      Return a collection of the caches known by this cache manager.
      Specified by:
        `getCacheNames` in interface `CacheManager`
      Returns:
        names of caches known by the cache manager.

    - #### getCache

          public Cache getCache(String name)

      Description copied from interface: `CacheManager`
      Return the cache associated with the given name.
      Specified by:
        `getCache` in interface `CacheManager`
      Parameters:
        `name` - cache identifier (must not be `null`)
      Returns:
        associated cache, or `null` if none is found

    - #### createConcurrentMapCache

          protected Cache createConcurrentMapCache(String name)

      Create a new ConcurrentMapCache instance for the specified cache name.
      Parameters:
        `name` - the name of the cache
      Returns:
        the ConcurrentMapCache (or a decorator thereof)