java.lang.Object
org.broadleafcommerce.common.extensibility.cache.DefaultJCacheUtil
org.broadleafcommerce.common.extensibility.cache.ehcache.DefaultEhCacheUtil
All Implemented Interfaces:
JCacheUtil

@Component("blJCacheUtil") @ConditionalOnEhCache public class DefaultEhCacheUtil extends DefaultJCacheUtil
Allows an encapsulated way to create caches programmatically from an EhCache CacheManager. The standard APIs do not provide enough control, so we encapsulate those details here.
Author:
Kelly Tisdell
  • Constructor Details

    • DefaultEhCacheUtil

      public DefaultEhCacheUtil(String uri)
    • DefaultEhCacheUtil

      @Autowired public DefaultEhCacheUtil(javax.cache.CacheManager cacheManager)
    • DefaultEhCacheUtil

      public DefaultEhCacheUtil(URI uri)
  • Method Details

    • getCache

      public <K, V> javax.cache.Cache<K,V> getCache(String cacheName)
      Description copied from interface: JCacheUtil
      Returns the cache associated with the name or null if no cache exists.
      Specified by:
      getCache in interface JCacheUtil
      Overrides:
      getCache in class DefaultJCacheUtil
      Returns:
    • createCache

      public javax.cache.Cache<Object,Object> createCache(String cacheName, int ttlSeconds, int maxElementsInMemory)
      Description copied from interface: JCacheUtil
      Returns a new Cache with the appropriate cache name, TTL, and maxElements. If the cache exists, an exception will be thrown.

      The ttl and maxElementsInMemory settings may be implementation specific and so implementors may choose to ignore these arguments.

      If ttlSeconds is less than 1 then the cache will not expire.

      Specified by:
      createCache in interface JCacheUtil
      Overrides:
      createCache in class DefaultJCacheUtil
      Returns:
    • createCache

      public <K, V> javax.cache.Cache<K,V> createCache(String cacheName, int ttlSeconds, int maxElementsInMemory, Class<K> key, Class<V> value)
      Description copied from interface: JCacheUtil
      Returns a new Cache with the appropriate cache name, TTL, and maxElements. If the cache exists, an exception will be thrown.

      The ttl and maxElementsInMemory settings may be implementation specific and so implementors may choose to ignore these arguments.

      If ttlSeconds is less than 0 then the cache will not expire.

      Specified by:
      createCache in interface JCacheUtil
      Overrides:
      createCache in class DefaultJCacheUtil
      Returns: