K - the type of cache keysV - the type of cache valuespublic final class TouchedExpiryPolicy<K,V> extends Object implements ExpiryPolicy<K,V>, Serializable
ExpiryPolicy that defines the expiry Duration
of a Cache Entry based on when it was last touched. A touch includes
creation, update or access.| Modifier and Type | Field and Description |
|---|---|
static long |
serialVersionUID
The serialVersionUID required for
Serializable. |
| Constructor and Description |
|---|
TouchedExpiryPolicy(Duration expiryDuration)
Constructs an
TouchedExpiryPolicy ExpiryPolicy. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
static <K,V> Factory<ExpiryPolicy<? super K,? super V>> |
factoryOf(Duration duration)
Obtains a
Factory for a Touched ExpiryPolicy. |
Duration |
getExpiryForAccessedEntry(Cache.Entry<? extends K,? extends V> entry)
Gets the duration before the accessed Cache.Entry is considered expired.
|
Duration |
getExpiryForCreatedEntry(Cache.Entry<? extends K,? extends V> entry)
Gets the duration before the newly Cache.Entry is considered expired.
|
Duration |
getExpiryForModifiedEntry(Cache.Entry<? extends K,? extends V> entry)
Gets the duration before the modified Cache.Entry is considered expired.
|
int |
hashCode() |
public static final long serialVersionUID
Serializable.public TouchedExpiryPolicy(Duration expiryDuration)
TouchedExpiryPolicy ExpiryPolicy.expiryDuration - the Duration a Cache Entry should exist be
before it expires after being modifiedpublic static <K,V> Factory<ExpiryPolicy<? super K,? super V>> factoryOf(Duration duration)
Factory for a Touched ExpiryPolicy.Factory for a Touched ExpiryPolicy.public Duration getExpiryForCreatedEntry(Cache.Entry<? extends K,? extends V> entry)
Duration before the said entry expires. If a Duration.ZERO
is returned the Cache.Entry is considered to be already expired and will
not be added to the Cache.
Should an exception occur while determining the Duration, an implementation
specific default Duration will be used.getExpiryForCreatedEntry in interface ExpiryPolicy<K,V>entry - the cache entry that was createdpublic Duration getExpiryForAccessedEntry(Cache.Entry<? extends K,? extends V> entry)
Duration before the said entry expires in
the future. If a Duration.ZERO is returned the Cache.Entry will be
considered expired for future access. Returning null will
result in no change to the previously understood expiry Duration.
Should an exception occur while determining the Duration, an implementation
specific default Duration will be used.getExpiryForAccessedEntry in interface ExpiryPolicy<K,V>entry - the cache entry that was accessedpublic Duration getExpiryForModifiedEntry(Cache.Entry<? extends K,? extends V> entry)
Duration before the updated entry expires.
If a Duration.ZERO is returned the Cache.Entry is considered already
expired. Returning null will result in no change to the
previously understood expiry Duration.
Should an exception occur while determining the Duration, an implementation
specific default Duration will be used.getExpiryForModifiedEntry in interface ExpiryPolicy<K,V>entry - the cache entry that was modifiedCopyright © 2013. All Rights Reserved.