Module com.github.benmanes.caffeine
Interface Policy.CacheEntry<K,V>
- Type Parameters:
K- the type of keysV- the type of values
- All Superinterfaces:
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 afterward.
-
Method Summary
Modifier and TypeMethodDescriptiondefault DurationReturns the duration betweenexpiresAt()andsnapshotAt().longReturns theTicker.read()ticks for when this entry expires.default DurationReturns the duration betweenrefreshableAt()andsnapshotAt().longReturns theTicker.read()ticks for when this entry becomes refreshable.longReturns theTicker.read()ticks for when this snapshot of the entry was taken.intweight()Returns the entry's weight.
-
Method Details
-
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 value is roughlyLong.MAX_VALUEticks away from thesnapshotAt()reading.- Returns:
- the ticker reading for when the entry expires
-
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 this value is roughlyLong.MAX_VALUEticks away from thesnapshotAt()reading.- Returns:
- the ticker reading for when the entry may be refreshed
-
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.
-