K
- the type of cache keysV
- the type of cache valuespublic final class AccessedExpiryPolicy<K,V> extends Object implements ExpiryPolicy<K,V>, Serializable
ExpiryPolicy
that defines the expiry Duration
of a Cache Entry based on the last time it was accessed. Accessed
does not include a cache update.Modifier and Type | Field and Description |
---|---|
static long |
serialVersionUID
The serialVersionUID required for
Serializable . |
Constructor and Description |
---|
AccessedExpiryPolicy(Duration expiryDuration)
Constructs an
AccessedExpiryPolicy 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 an Accessed 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 AccessedExpiryPolicy(Duration expiryDuration)
AccessedExpiryPolicy
ExpiryPolicy
.expiryDuration
- the Duration
a Cache Entry should exist be
before it expires after being accessedpublic static <K,V> Factory<ExpiryPolicy<? super K,? super V>> factoryOf(Duration duration)
Factory
for an Accessed ExpiryPolicy
.Factory
for an Accessed 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.