Module com.github.benmanes.caffeine
Interface Policy.CacheEntry<K,V>
-
- All Superinterfaces:
Map.Entry<K,V>
public static interface Policy.CacheEntry<K,V> extends Map.Entry<K,V>
A key-value pair that may include policy metadata for the cached entry. Unless otherwise specified, this is a value-based class, it can be assumed that the implementation is an immutable snapshot of the cached data at the time of this entry's creation, and it will not reflect changes afterwards.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Duration
expiresAfter()
Returns the duration betweenexpiresAt()
andsnapshotAt()
.long
expiresAt()
Returns theTicker.read()
ticks for when this entry expires.default Duration
refreshableAfter()
Returns the duration betweenrefreshableAt()
andsnapshotAt()
.long
refreshableAt()
Returns theTicker.read()
ticks for when this entry becomes refreshable.long
snapshotAt()
Returns theTicker.read()
ticks for when this snapshot of the entry was taken.int
weight()
Returns the entry's weight.
-
-
-
Method Detail
-
weight
int weight()
Returns the entry's weight. If the cache was not configured with a maximum weight then this value is always1
.- Returns:
- the weight if the entry
-
expiresAt
long expiresAt()
Returns theTicker.read()
ticks for when this entry expires. If the cache was not configured with an expiration policy then this method always aroundLong.MAX_VALUE
ticks from thesnapshotAt()
reading.- Returns:
- the ticker reading for when the entry expires
-
expiresAfter
default Duration expiresAfter()
Returns the duration betweenexpiresAt()
andsnapshotAt()
.- Returns:
- the length of time after which the entry will be automatically removed
-
refreshableAt
long refreshableAt()
Returns theTicker.read()
ticks for when this entry becomes refreshable. If the cache was not configured with a refresh policy then always aroundLong.MAX_VALUE
ticks from thesnapshotAt()
reading.- Returns:
- the ticker reading for when the entry may be refreshed
-
refreshableAfter
default Duration refreshableAfter()
Returns the duration betweenrefreshableAt()
andsnapshotAt()
.- Returns:
- the length of time after which an entry is eligible to be reloaded
-
snapshotAt
long snapshotAt()
Returns theTicker.read()
ticks for when this snapshot of the entry was taken. This reading may be a constant if no time-based policy is configured.- Returns:
- the ticker reading for when this snapshot of the entry was taken.
-
-