org.springframework.cache.ehcache

## Class EhCacheCacheManager

- java.lang.Object
- - org.springframework.cache.support.AbstractCacheManager
  - - org.springframework.cache.transaction.AbstractTransactionSupportingCacheManager
    - - org.springframework.cache.ehcache.EhCacheCacheManager

- All Implemented Interfaces:
    InitializingBean, CacheManager

      public class EhCacheCacheManager
      extends AbstractTransactionSupportingCacheManager

  CacheManager backed by an EhCache `CacheManager`.
  Since:
    3.1
  Author:
    Costin Leau, Juergen Hoeller

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `EhCacheCacheManager()` Create a new EhCacheCacheManager, setting the target EhCache CacheManager through the `setCacheManager(net.sf.ehcache.CacheManager)` bean property.
    `EhCacheCacheManager(CacheManager cacheManager)` Create a new EhCacheCacheManager for the given backing EhCache CacheManager.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Cache` | `getCache(String name)` Return the cache associated with the given name.
    `CacheManager` | `getCacheManager()` Return the backing EhCache `CacheManager`.
    `protected Collection<Cache>` | `loadCaches()` Load the caches for this cache manager.
    `void` | `setCacheManager(CacheManager cacheManager)` Set the backing EhCache `CacheManager`.

    - ### Methods inherited from class org.springframework.cache.transaction.AbstractTransactionSupportingCacheManager

      `decorateCache, isTransactionAware, setTransactionAware`

    - ### Methods inherited from class org.springframework.cache.support.AbstractCacheManager

      `addCache, afterPropertiesSet, getCacheNames`

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

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

- - ### Constructor Detail

    - #### EhCacheCacheManager

          public EhCacheCacheManager()

      Create a new EhCacheCacheManager, setting the target EhCache CacheManager through the `setCacheManager(net.sf.ehcache.CacheManager)` bean property.

    - #### EhCacheCacheManager

          public EhCacheCacheManager(CacheManager cacheManager)

      Create a new EhCacheCacheManager for the given backing EhCache CacheManager.
      Parameters:
        `cacheManager` - the backing EhCache `CacheManager`

  - ### Method Detail

    - #### setCacheManager

          public void setCacheManager(CacheManager cacheManager)

      Set the backing EhCache `CacheManager`.

    - #### getCacheManager

          public CacheManager getCacheManager()

      Return the backing EhCache `CacheManager`.

    - #### loadCaches

          protected Collection<Cache> loadCaches()

      Description copied from class: `AbstractCacheManager`
      Load the caches for this cache manager. Occurs at startup. The returned collection must not be null.
      Specified by:
        `loadCaches` in class `AbstractCacheManager`

    - #### 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`
      Overrides:
        `getCache` in class `AbstractCacheManager`
      Parameters:
        `name` - the cache identifier (must not be `null`)
      Returns:
        the associated cache, or `null` if none found