org.springframework.cache.jcache

## Class JCacheCacheManager

- java.lang.Object
- - org.springframework.cache.support.AbstractCacheManager
  - - org.springframework.cache.transaction.AbstractTransactionSupportingCacheManager
    - - org.springframework.cache.jcache.JCacheCacheManager

- All Implemented Interfaces:
    InitializingBean, CacheManager

      public class JCacheCacheManager
      extends AbstractTransactionSupportingCacheManager

  `CacheManager` implementation backed by a JCache `CacheManager`.

  Note: This class has been updated for JCache 1.0, as of Spring 4.0.

  Since:
    3.2
  Author:
    Juergen Hoeller

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JCacheCacheManager()` Create a new JCacheCacheManager, setting the target JCache CacheManager through the `setCacheManager(javax.cache.CacheManager)` bean property.
    `JCacheCacheManager(javax.cache.CacheManager cacheManager)` Create a new JCacheCacheManager for the given backing JCache.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterPropertiesSet()` Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).
    `Cache` | `getCache(String name)` Return the cache associated with the given name.
    `javax.cache.CacheManager` | `getCacheManager()` Return the backing JCache `CacheManager`.
    `boolean` | `isAllowNullValues()` Return whether this cache manager accepts and converts `null` values for all of its caches.
    `protected Collection<Cache>` | `loadCaches()` Load the caches for this cache manager.
    `void` | `setAllowNullValues(boolean allowNullValues)` Specify whether to accept and convert `null` values for all caches in this cache manager.
    `void` | `setCacheManager(javax.cache.CacheManager cacheManager)` Set the backing JCache `CacheManager`.

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

      `decorateCache, isTransactionAware, setTransactionAware`

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

      `addCache, getCacheNames`

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

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

- - ### Constructor Detail

    - #### JCacheCacheManager

          public JCacheCacheManager()

      Create a new JCacheCacheManager, setting the target JCache CacheManager through the `setCacheManager(javax.cache.CacheManager)` bean property.

    - #### JCacheCacheManager

          public JCacheCacheManager(javax.cache.CacheManager cacheManager)

      Create a new JCacheCacheManager for the given backing JCache.
      Parameters:
        `cacheManager` - the backing JCache `CacheManager`

  - ### Method Detail

    - #### setCacheManager

          public void setCacheManager(javax.cache.CacheManager cacheManager)

      Set the backing JCache `CacheManager`.

    - #### getCacheManager

          public javax.cache.CacheManager getCacheManager()

      Return the backing JCache `CacheManager`.

    - #### setAllowNullValues

          public void setAllowNullValues(boolean allowNullValues)

      Specify whether to accept and convert `null` values for all caches in this cache manager.

      Default is "true", despite JSR-107 itself not supporting `null` values. An internal holder object will be used to store user-level `null`s.

    - #### isAllowNullValues

          public boolean isAllowNullValues()

      Return whether this cache manager accepts and converts `null` values for all of its caches.

    - #### afterPropertiesSet

          public void afterPropertiesSet()

      Description copied from interface: `InitializingBean`
      Invoked by a BeanFactory after it has set all bean properties supplied (and satisfied BeanFactoryAware and ApplicationContextAware).

      This method allows the bean instance to perform initialization only possible when all bean properties have been set and to throw an exception in the event of misconfiguration.

      Specified by:
        `afterPropertiesSet` in interface `InitializingBean`
      Overrides:
        `afterPropertiesSet` in class `AbstractCacheManager`

    - #### 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