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`.
  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

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `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, afterPropertiesSet, 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 values.

    - #### isAllowNullValues

          public boolean isAllowNullValues()

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

    - #### 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` - cache identifier (must not be `null`)
      Returns:
        associated cache, or `null` if none is found