Class TouchedExpiryPolicy
- All Implemented Interfaces:
Serializable, ExpiryPolicy
ExpiryPolicy that defines the expiry Duration
of a Cache Entry based on when it was last touched. A touch includes
creation, update or access.- Since:
- 1.0
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate DurationTheDurationa Cache Entry should be available before it expires.static final longThe serialVersionUID required forSerializable. -
Constructor Summary
ConstructorsConstructorDescriptionTouchedExpiryPolicy(Duration expiryDuration) Constructs anTouchedExpiryPolicyExpiryPolicy. -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic Factory<ExpiryPolicy> Obtains aFactoryfor a TouchedExpiryPolicy.Gets theDurationbefore an accessed Cache.Entry is considered expired.Gets theDurationbefore a newly created Cache.Entry is considered expired.Gets theDurationbefore an updated Cache.Entry is considered expired.inthashCode()
-
Field Details
-
serialVersionUID
-
expiryDuration
-
-
Constructor Details
-
TouchedExpiryPolicy
Constructs anTouchedExpiryPolicyExpiryPolicy.- Parameters:
expiryDuration- theDurationa Cache Entry should exist be before it expires after being modified
-
-
Method Details
-
factoryOf
Obtains aFactoryfor a TouchedExpiryPolicy.- Parameters:
duration- The expiry duration- Returns:
- a
Factoryfor a TouchedExpiryPolicy.
-
getExpiryForCreation
Gets theDurationbefore 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
Durationbefore an entry expires. If aDuration.ZEROis 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
Durationwill be used.- Specified by:
getExpiryForCreationin interfaceExpiryPolicy- Returns:
- the new
Durationbefore a created entry expires
-
getExpiryForAccess
Gets theDurationbefore an accessed Cache.Entry is considered expired.This method is called by a caching implementation after a Cache.Entry is accessed to determine the
Durationbefore an entry expires. If aDuration.ZEROis returned a Cache.Entry will be considered immediately expired. Returningnullwill 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:
getExpiryForAccessin interfaceExpiryPolicy- Returns:
- the new
Durationbefore an accessed entry expires
-
getExpiryForUpdate
Gets theDurationbefore an updated Cache.Entry is considered expired.This method is called by the caching implementation after a Cache.Entry is updated to determine the
Durationbefore the updated entry expires. If aDuration.ZEROis returned a Cache.Entry is considered immediately expired. Returningnullwill 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:
getExpiryForUpdatein interfaceExpiryPolicy- Returns:
- the new
Durationbefore an updated entry expires
-
hashCode
-
equals
-