java.lang.Object
org.broadleafcommerce.common.extensibility.cache.ehcache.DefaultExpiryPolicy
All Implemented Interfaces:
org.ehcache.expiry.ExpiryPolicy<Object,Object>
Direct Known Subclasses:
InfiniteExpiryPolicy, OneHourExpiryPolicy, OneMinuteExpiryPolicy, TenMinuteExpiryPolicy, ThirtyMinuteExpiryPolicy, TwelveHourExpiryPolicy, TwentyFourHourExpiryPolicy

public class DefaultExpiryPolicy extends Object implements org.ehcache.expiry.ExpiryPolicy<Object,Object>
Defines a default ExpiryPolicy for EhCache. In particular, this takes a TTL in seconds and converts it to a Cache duration or TTL. This provides both a default TTL for caches created with it programmatically, as well as a way of mapping per-entry TTL values in EhCache when the cached value is an instance of TimedValueHolder.
Author:
Kelly Tisdell
  • Constructor Details

    • DefaultExpiryPolicy

      public DefaultExpiryPolicy()
      Creates a new ExpiryPolicy with an infinite default duration.
    • DefaultExpiryPolicy

      public DefaultExpiryPolicy(int defaultTTLSeconds)
      creates a new ExpiryPolicy with a duration equal to the number of seconds passed in as a argument.
      Parameters:
      defaultTTLSeconds -
  • Method Details

    • getExpiryForCreation

      public Duration getExpiryForCreation(Object key, Object value)
      Specified by:
      getExpiryForCreation in interface org.ehcache.expiry.ExpiryPolicy<Object,Object>
    • getExpiryForAccess

      public Duration getExpiryForAccess(Object key, Supplier<?> value)
      Specified by:
      getExpiryForAccess in interface org.ehcache.expiry.ExpiryPolicy<Object,Object>
    • getExpiryForUpdate

      public Duration getExpiryForUpdate(Object key, Supplier<?> oldValue, Object newValue)
      Specified by:
      getExpiryForUpdate in interface org.ehcache.expiry.ExpiryPolicy<Object,Object>
    • getDefaultDuration

      protected Duration getDefaultDuration()