org.apache.geode.cache

## Interface CustomExpiry<K,V>

- All Superinterfaces:
    CacheCallback, Declarable
  All Known Implementing Classes:
    RegionTestCase.TestExpiry, SessionCustomExpiry

      public interface CustomExpiry<K,V>
      extends CacheCallback

  This is the contract that a `custom-expiry` element must honor. It determines the expiration characteristics for a specific entry in a region.

  Note that if you wish to refer to an implementation of this interface in XML, the implementation must also implement the Declarable interface.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `ExpirationAttributes` | `getExpiry(Region.Entry<K,V> entry)` Calculate the expiration for a given entry.

    - ### Methods inherited from interface org.apache.geode.cache.CacheCallback

      `close`

    - ### Methods inherited from interface org.apache.geode.cache.Declarable

      `init, initialize`

- - ### Method Detail

    - #### getExpiry

          ExpirationAttributes getExpiry(Region.Entry<K,V> entry)

      Calculate the expiration for a given entry. Returning null indicates that the default for the region should be used.

      The entry parameter should not be used after this method invocation completes.

      Parameters:
        `entry` - the entry to calculate the expiration for
      Returns:
        the expiration to be used, null if the region's defaults should be used.