org.ehcache.expiry
Class Expirations

java.lang.Object
  extended by org.ehcache.expiry.Expirations

public final class Expirations
extends java.lang.Object

Utility class for getting predefined Expiry instances.


Method Summary
static Expiry<java.lang.Object,java.lang.Object> noExpiration()
          Get an Expiry instance for a non expiring (ie.
static
<K,V> Expiry<K,V>
timeToIdleExpiration(Duration timeToIdle)
          Get a time-to-idle (TTI) Expiry instance for the given duration
static
<K,V> Expiry<K,V>
timeToLiveExpiration(Duration timeToLive)
          Get a time-to-live (TTL) Expiry instance for the given duration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

noExpiration

public static Expiry<java.lang.Object,java.lang.Object> noExpiration()
Get an Expiry instance for a non expiring (ie. "eternal") cache

Returns:
no expiry instance

timeToLiveExpiration

public static <K,V> Expiry<K,V> timeToLiveExpiration(Duration timeToLive)
Get a time-to-live (TTL) Expiry instance for the given duration

Type Parameters:
K - the type of the keys used to access data within the cache
V - the type of the values held within the cache
Parameters:
timeToLive - the duration of TTL
Returns:
a TTL expiry

timeToIdleExpiration

public static <K,V> Expiry<K,V> timeToIdleExpiration(Duration timeToIdle)
Get a time-to-idle (TTI) Expiry instance for the given duration

Type Parameters:
K - the type of the keys used to access data within the cache
V - the type of the values held within the cache
Parameters:
timeToIdle - the duration of TTI
Returns:
a TTI expiry