Class Expirations.BaseExpiry<K,V>

java.lang.Object
org.ehcache.expiry.Expirations.BaseExpiry<K,V>
All Implemented Interfaces:
Expiry<K,V>
Direct Known Subclasses:
Expirations.NoExpiry, Expirations.TimeToIdleExpiry, Expirations.TimeToLiveExpiry
Enclosing class:
Expirations

@Deprecated private static class Expirations.BaseExpiry<K,V> extends Object implements Expiry<K,V>
Deprecated.
Simple implementation of the Expiry interface allowing to set constants to each expiry types.
  • Field Details

    • create

      private final Duration create
      Deprecated.
    • access

      private final Duration access
      Deprecated.
    • update

      private final Duration update
      Deprecated.
  • Constructor Details

  • Method Details

    • getExpiryForCreation

      public Duration getExpiryForCreation(K key, V value)
      Deprecated.
      Description copied from interface: Expiry
      Returns the lifetime of an entry when it is initially added to a Cache.

      This method must not return null.

      Exceptions thrown from this method will be swallowed and result in the expiry duration being ZERO.

      Specified by:
      getExpiryForCreation in interface Expiry<K,V>
      Parameters:
      key - the key of the newly added entry
      value - the value of the newly added entry
      Returns:
      a non-null Duration
    • getExpiryForAccess

      public Duration getExpiryForAccess(K key, ValueSupplier<? extends V> value)
      Deprecated.
      Description copied from interface: Expiry
      Returns the expiration Duration (relative to the current time) when an existing entry is accessed from a Cache.

      Returning null indicates that the expiration time remains unchanged.

      Exceptions thrown from this method will be swallowed and result in the expiry duration being ZERO.

      Specified by:
      getExpiryForAccess in interface Expiry<K,V>
      Parameters:
      key - the key of the accessed entry
      value - a value supplier for the accessed entry
      Returns:
      an expiration Duration, null means unchanged
    • getExpiryForUpdate

      public Duration getExpiryForUpdate(K key, ValueSupplier<? extends V> oldValue, V newValue)
      Deprecated.
      Description copied from interface: Expiry
      Returns the expiration Duration (relative to the current time) when an existing entry is updated in a Cache.

      Returning null indicates that the expiration time remains unchanged.

      Exceptions thrown from this method will be swallowed and result in the expiry duration being ZERO.

      Specified by:
      getExpiryForUpdate in interface Expiry<K,V>
      Parameters:
      key - the key of the updated entry
      oldValue - a value supplier for the previous value of the entry
      newValue - the new value of the entry
      Returns:
      an expiration Duration, null means unchanged
    • equals

      public boolean equals(Object o)
      Deprecated.
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Deprecated.
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Deprecated.
      Overrides:
      toString in class Object