Class CreatedExpiryPolicy
- All Implemented Interfaces:
Serializable
,ExpiryPolicy
ExpiryPolicy
that defines the expiry Duration
of a Cache Entry based on when it was created. An update does not reset
the expiry time.- Since:
- 1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Duration
TheDuration
a Cache Entry should be available before it expires.static final long
The serialVersionUID required forSerializable
. -
Constructor Summary
ConstructorsConstructorDescriptionCreatedExpiryPolicy
(Duration expiryDuration) Constructs anCreatedExpiryPolicy
ExpiryPolicy
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
static Factory
<ExpiryPolicy> Obtains aFactory
for a CreatedExpiryPolicy
.Gets theDuration
before an accessed Cache.Entry is considered expired.Gets theDuration
before a newly created Cache.Entry is considered expired.Gets theDuration
before an updated Cache.Entry is considered expired.int
hashCode()
-
Field Details
-
serialVersionUID
public static final long serialVersionUIDThe serialVersionUID required forSerializable
.- See Also:
-
expiryDuration
TheDuration
a Cache Entry should be available before it expires.
-
-
Constructor Details
-
CreatedExpiryPolicy
Constructs anCreatedExpiryPolicy
ExpiryPolicy
.- Parameters:
expiryDuration
- theDuration
a Cache Entry should exist be before it expires after being modified
-
-
Method Details
-
factoryOf
Obtains aFactory
for a CreatedExpiryPolicy
.- Parameters:
duration
- The expiry duration- Returns:
- a
Factory
for a CreatedExpiryPolicy
.
-
getExpiryForCreation
Gets theDuration
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 aDuration.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.- Specified by:
getExpiryForCreation
in interfaceExpiryPolicy
- Returns:
- the new
Duration
before a created entry expires
-
getExpiryForAccess
Gets theDuration
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 aDuration.ZERO
is returned a Cache.Entry will be considered immediately expired. Returningnull
will result in no change to the previously understood expiryDuration
.Should an exception occur while determining the Duration, an implementation specific default Duration will be used.
- Specified by:
getExpiryForAccess
in interfaceExpiryPolicy
- Returns:
- the new
Duration
before an accessed entry expires
-
getExpiryForUpdate
Gets theDuration
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 aDuration.ZERO
is returned a Cache.Entry is considered immediately expired. Returningnull
will result in no change to the previously understood expiryDuration
.Should an exception occur while determining the Duration, an implementation specific default Duration will be used.
- Specified by:
getExpiryForUpdate
in interfaceExpiryPolicy
- Returns:
- the new
Duration
before an updated entry expires
-
hashCode
public int hashCode() -
equals
-