Serializable
, ExpiryPolicy
public final class ModifiedExpiryPolicy extends Object implements ExpiryPolicy, Serializable
ExpiryPolicy
that defines the expiry Duration
of a Cache Entry based on the last time it was updated. Updating
includes created and changing (updating) an entry.ExpiryPolicy
,
Serialized FormModifier and Type | Field | Description |
---|---|---|
static long |
serialVersionUID |
The serialVersionUID required for
Serializable . |
Constructor | Description |
---|---|
ModifiedExpiryPolicy(Duration expiryDuration) |
Constructs an
ModifiedExpiryPolicy ExpiryPolicy . |
Modifier and Type | Method | Description |
---|---|---|
boolean |
equals(Object object) |
|
static Factory<ExpiryPolicy> |
factoryOf(Duration duration) |
Obtains a
Factory for a Modified ExpiryPolicy . |
Duration |
getExpiryForAccess() |
Gets the
Duration before an accessed Cache.Entry is
considered expired. |
Duration |
getExpiryForCreation() |
Gets the
Duration before a newly created Cache.Entry is considered
expired. |
Duration |
getExpiryForUpdate() |
Gets the
Duration before an updated Cache.Entry is considered
expired. |
int |
hashCode() |
public static final long serialVersionUID
Serializable
.public ModifiedExpiryPolicy(Duration expiryDuration)
ModifiedExpiryPolicy
ExpiryPolicy
.expiryDuration
- the Duration
a Cache Entry should exist be
before it expires after being modifiedpublic static Factory<ExpiryPolicy> factoryOf(Duration duration)
Factory
for a Modified ExpiryPolicy
.duration
- The expiry durationFactory
for a Modified ExpiryPolicy
.public Duration getExpiryForCreation()
Duration
before a newly created Cache.Entry is considered
expired.
This method is called by a caching implementation after a Cache.Entry is
created, but before a Cache.Entry is added to a cache, to determine the
Duration
before an entry expires. If a Duration.ZERO
is returned the new 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.
getExpiryForCreation
in interface ExpiryPolicy
Duration
before a created entry expirespublic Duration getExpiryForAccess()
Duration
before an accessed Cache.Entry is
considered expired.
This method is called by a caching implementation after a Cache.Entry is
accessed to determine the Duration
before an entry expires. If a
Duration.ZERO
is returned a Cache.Entry will be
considered immediately 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.
getExpiryForAccess
in interface ExpiryPolicy
Duration
before an accessed entry expirespublic Duration getExpiryForUpdate()
Duration
before an updated Cache.Entry is considered
expired.
This method is called by the caching implementation after a Cache.Entry is
updated to determine the Duration
before the updated entry expires.
If a Duration.ZERO
is returned a Cache.Entry is considered
immediately 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.
getExpiryForUpdate
in interface ExpiryPolicy
Duration
before an updated entry expiresCopyright © 2017. All rights reserved.