Interface ExpiryPolicy
-
- All Known Implementing Classes:
AccessedExpiryPolicy,CreatedExpiryPolicy,EternalExpiryPolicy,ModifiedExpiryPolicy,TouchedExpiryPolicy
public interface ExpiryPolicyDefines functions to determine when cache entries will expire based on creation, access and modification operations.Each of the functions return a new
Durationthat specifies the amount of time that must pass before a cache entry is considered expired.Durationhas constants defined for useful durations.- Since:
- 1.0
- See Also:
Duration
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description DurationgetExpiryForAccess()Gets theDurationbefore an accessed Cache.Entry is considered expired.DurationgetExpiryForCreation()Gets theDurationbefore a newly created Cache.Entry is considered expired.DurationgetExpiryForUpdate()Gets theDurationbefore an updated Cache.Entry is considered expired.
-
-
-
Method Detail
-
getExpiryForCreation
Duration 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.- Returns:
- the new
Durationbefore a created entry expires
-
getExpiryForAccess
Duration 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.
- Returns:
- the new
Durationbefore an accessed entry expires
-
getExpiryForUpdate
Duration 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.
- Returns:
- the new
Durationbefore an updated entry expires
-
-