Top Description Inners Fields Constructors Methods
com.github.benmanes.caffeine.cache

pack-priv Class SnapshotEntry<K, V>

extends Object
implements Policy.CacheEntry<K, V>
Class Inheritance
All Implemented Interfaces
com.github.benmanes.caffeine.cache.Policy.CacheEntry, java.util.Map.Entry
Known Direct Subclasses
com.github.benmanes.caffeine.cache.SnapshotEntry.WeightedEntry, com.github.benmanes.caffeine.cache.SnapshotEntry.ExpirableEntry
Annotations
@Immutable
containerOf:K, V
Static Imports
java.util.Objects.requireNonNull

An immutable entry that includes a snapshot of the policy metadata at its time of creation.
Author
[email protected] (Ben Manes)

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private final K
private final long
private final V

Constructor Summary

AccessConstructor and Description
pack-priv
SnapshotEntry(K key, V value, long snapshot)

Method Summary

Modifier and TypeMethod and Description
public boolean
equals(Object
object to be compared for equality with this map entry
o
)

Overrides java.lang.Object.equals.

Implements java.util.Map.Entry.equals.

Compares the specified object with this entry for equality.
public long
expiresAt()

Implements com.github.benmanes.caffeine.cache.Policy.CacheEntry.expiresAt.

Returns the Ticker#read() ticks for when this entry expires.
public static <K, V> SnapshotEntry<K, V>
forEntry(K key, V value)

Returns a cache entry containing the given key, value, and snapshot.

public static <K, V> SnapshotEntry<K, V>
forEntry(K key, V value, long snapshot, int weight, long expiresAt, long refreshableAt)

Returns a cache entry with the specified metadata.

public K
getKey()

Implements java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.
public V
getValue()

Implements java.util.Map.Entry.getValue.

Returns the value corresponding to this entry.
public int
hashCode()

Overrides java.lang.Object.hashCode.

Implements java.util.Map.Entry.hashCode.

Returns the hash code value for this map entry.
public long
refreshableAt()

Implements com.github.benmanes.caffeine.cache.Policy.CacheEntry.refreshableAt.

Returns the Ticker#read() ticks for when this entry becomes refreshable.
public V
setValue(V
new value to be stored in this entry
value
)

Implements java.util.Map.Entry.setValue.

Replaces the value corresponding to this entry with the specified value (optional operation).
public long
snapshotAt()

Implements com.github.benmanes.caffeine.cache.Policy.CacheEntry.snapshotAt.

Returns the Ticker#read() ticks for when this snapshot of the entry was taken.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
public int
Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

keyback to summary
private final K key
snapshotback to summary
private final long snapshot
valueback to summary
private final V value

Constructor Detail

SnapshotEntryback to summary
pack-priv SnapshotEntry(K key, V value, long snapshot)

Method Detail

equalsback to summary
public boolean equals(Object o)

Overrides java.lang.Object.equals.

Implements java.util.Map.Entry.equals.

Doc from java.util.Map.Entry.equals.

Compares the specified object with this entry for equality. Returns true if the given object is also a map entry and the two entries represent the same mapping. More formally, two entries e1 and e2 represent the same mapping if

    (e1.getKey()==null ?
     e2.getKey()==null : e1.getKey().equals(e2.getKey()))  &&
    (e1.getValue()==null ?
     e2.getValue()==null : e1.getValue().equals(e2.getValue()))
This ensures that the equals method works properly across different implementations of the Map.Entry interface.
Parameters
o:Object

object to be compared for equality with this map entry

Returns:boolean

true if the specified object is equal to this map entry

Annotations
@Override
expiresAtback to summary
public long expiresAt()

Implements com.github.benmanes.caffeine.cache.Policy.CacheEntry.expiresAt.

Doc from com.github.benmanes.caffeine.cache.Policy.CacheEntry.expiresAt.

Returns the Ticker#read() ticks for when this entry expires. If the cache was not configured with an expiration policy then this value is roughly Long#MAX_VALUE ticks away from the snapshotAt() reading.

Returns:long

the ticker reading for when the entry expires

Annotations
@Override
forEntryback to summary
public static <K, V> SnapshotEntry<K, V> forEntry(K key, V value)

Returns a cache entry containing the given key, value, and snapshot.

forEntryback to summary
public static <K, V> SnapshotEntry<K, V> forEntry(K key, V value, long snapshot, int weight, long expiresAt, long refreshableAt)

Returns a cache entry with the specified metadata.

getKeyback to summary
public K getKey()

Implements java.util.Map.Entry.getKey.

Doc from java.util.Map.Entry.getKey.

Returns the key corresponding to this entry.

Returns:K

the key corresponding to this entry

Annotations
@Override
getValueback to summary
public V getValue()

Implements java.util.Map.Entry.getValue.

Doc from java.util.Map.Entry.getValue.

Returns the value corresponding to this entry. If the mapping has been removed from the backing map (by the iterator's remove operation), the results of this call are undefined.

Returns:V

the value corresponding to this entry

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Implements java.util.Map.Entry.hashCode.

Doc from java.util.Map.Entry.hashCode.

Returns the hash code value for this map entry. The hash code of a map entry e is defined to be:

    (e.getKey()==null   ? 0 : e.getKey().hashCode()) ^
    (e.getValue()==null ? 0 : e.getValue().hashCode())
This ensures that e1.equals(e2) implies that e1.hashCode()==e2.hashCode() for any two Entries e1 and e2, as required by the general contract of Object.hashCode.
Returns:int

the hash code value for this map entry

Annotations
@Override
refreshableAtback to summary
public long refreshableAt()

Implements com.github.benmanes.caffeine.cache.Policy.CacheEntry.refreshableAt.

Doc from com.github.benmanes.caffeine.cache.Policy.CacheEntry.refreshableAt.

Returns the Ticker#read() ticks for when this entry becomes refreshable. If the cache was not configured with a refresh policy then this value is roughly Long#MAX_VALUE ticks away from the snapshotAt() reading.

Returns:long

the ticker reading for when the entry may be refreshed

Annotations
@Override
setValueback to summary
public V setValue(V value)

Implements java.util.Map.Entry.setValue.

Doc from java.util.Map.Entry.setValue.

Replaces the value corresponding to this entry with the specified value (optional operation). (Writes through to the map.) The behavior of this call is undefined if the mapping has already been removed from the map (by the iterator's remove operation).

Parameters
value:V

new value to be stored in this entry

Returns:V

old value corresponding to the entry

Annotations
@Override
snapshotAtback to summary
public long snapshotAt()

Implements com.github.benmanes.caffeine.cache.Policy.CacheEntry.snapshotAt.

Doc from com.github.benmanes.caffeine.cache.Policy.CacheEntry.snapshotAt.

Returns the Ticker#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:long

the ticker reading for when this snapshot of the entry was taken.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override
weightback to summary
public int weight()

Implements com.github.benmanes.caffeine.cache.Policy.CacheEntry.weight.

Doc from com.github.benmanes.caffeine.cache.Policy.CacheEntry.weight.

Returns the entry's weight. If the cache was not configured with a maximum weight then this value is always 1.

Returns:int

the weight if the entry

Annotations
@Override
com.github.benmanes.caffeine.cache back to summary

pack-priv final Class SnapshotEntry.CompleteEntry<K, V>

extends SnapshotEntry.ExpirableWeightedEntry<K, V>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final long
Inherited from com.github.benmanes.caffeine.cache.SnapshotEntry.ExpirableWeightedEntry:
expiresAt

Constructor Summary

AccessConstructor and Description
pack-priv
CompleteEntry(K key, V value, long snapshot, int weight, long expiresAt, long refreshableAt)

Method Summary

Modifier and TypeMethod and Description
public long
Inherited from com.github.benmanes.caffeine.cache.SnapshotEntry.ExpirableWeightedEntry:
expiresAt

Field Detail

refreshableAtback to summary
pack-priv final long refreshableAt

Constructor Detail

CompleteEntryback to summary
pack-priv CompleteEntry(K key, V value, long snapshot, int weight, long expiresAt, long refreshableAt)

Method Detail

refreshableAtback to summary
public long refreshableAt()

Overrides com.github.benmanes.caffeine.cache.SnapshotEntry.refreshableAt.

Implements com.github.benmanes.caffeine.cache.Policy.CacheEntry.refreshableAt.

Doc from com.github.benmanes.caffeine.cache.Policy.CacheEntry.refreshableAt.

Returns the Ticker#read() ticks for when this entry becomes refreshable. If the cache was not configured with a refresh policy then this value is roughly Long#MAX_VALUE ticks away from the snapshotAt() reading.

Returns:long

the ticker reading for when the entry may be refreshed

Annotations
@Override
com.github.benmanes.caffeine.cache back to summary

pack-priv Class SnapshotEntry.ExpirableEntry<K, V>

extends SnapshotEntry<K, V>
Class Inheritance
Known Direct Subclasses
com.github.benmanes.caffeine.cache.SnapshotEntry.RefreshableExpirableEntry

Field Summary

Modifier and TypeField and Description
pack-priv final long

Constructor Summary

AccessConstructor and Description
pack-priv
ExpirableEntry(K key, V value, long snapshot, long expiresAt)

Method Summary

Modifier and TypeMethod and Description
public long
Inherited from com.github.benmanes.caffeine.cache.SnapshotEntry:
equalsforEntryforEntrygetKeygetValuehashCoderefreshableAtsetValuesnapshotAttoStringweight

Field Detail

expiresAtback to summary
pack-priv final long expiresAt

Constructor Detail

ExpirableEntryback to summary
pack-priv ExpirableEntry(K key, V value, long snapshot, long expiresAt)

Method Detail

expiresAtback to summary
public long expiresAt()

Overrides com.github.benmanes.caffeine.cache.SnapshotEntry.expiresAt.

Implements com.github.benmanes.caffeine.cache.Policy.CacheEntry.expiresAt.

Doc from com.github.benmanes.caffeine.cache.Policy.CacheEntry.expiresAt.

Returns the Ticker#read() ticks for when this entry expires. If the cache was not configured with an expiration policy then this value is roughly Long#MAX_VALUE ticks away from the snapshotAt() reading.

Returns:long

the ticker reading for when the entry expires

Annotations
@Override
com.github.benmanes.caffeine.cache back to summary

pack-priv Class SnapshotEntry.ExpirableWeightedEntry<K, V>

extends SnapshotEntry.WeightedEntry<K, V>
Class Inheritance
Known Direct Subclasses
com.github.benmanes.caffeine.cache.SnapshotEntry.CompleteEntry

Field Summary

Modifier and TypeField and Description
pack-priv final long
Inherited from com.github.benmanes.caffeine.cache.SnapshotEntry.WeightedEntry:
weight

Constructor Summary

AccessConstructor and Description
pack-priv
ExpirableWeightedEntry(K key, V value, long snapshot, int weight, long expiresAt)

Method Summary

Modifier and TypeMethod and Description
public long
Inherited from com.github.benmanes.caffeine.cache.SnapshotEntry.WeightedEntry:
weight

Field Detail

expiresAtback to summary
pack-priv final long expiresAt

Constructor Detail

ExpirableWeightedEntryback to summary
pack-priv ExpirableWeightedEntry(K key, V value, long snapshot, int weight, long expiresAt)

Method Detail

expiresAtback to summary
public long expiresAt()

Overrides com.github.benmanes.caffeine.cache.SnapshotEntry.expiresAt.

Implements com.github.benmanes.caffeine.cache.Policy.CacheEntry.expiresAt.

Doc from com.github.benmanes.caffeine.cache.Policy.CacheEntry.expiresAt.

Returns the Ticker#read() ticks for when this entry expires. If the cache was not configured with an expiration policy then this value is roughly Long#MAX_VALUE ticks away from the snapshotAt() reading.

Returns:long

the ticker reading for when the entry expires

Annotations
@Override
com.github.benmanes.caffeine.cache back to summary

pack-priv Class SnapshotEntry.RefreshableExpirableEntry<K, V>

extends SnapshotEntry.ExpirableEntry<K, V>
Class Inheritance

Field Summary

Modifier and TypeField and Description
pack-priv final long
Inherited from com.github.benmanes.caffeine.cache.SnapshotEntry.ExpirableEntry:
expiresAt

Constructor Summary

AccessConstructor and Description
pack-priv
RefreshableExpirableEntry(K key, V value, long snapshot, long expiresAt, long refreshableAt)

Method Summary

Modifier and TypeMethod and Description
public long
Inherited from com.github.benmanes.caffeine.cache.SnapshotEntry.ExpirableEntry:
expiresAt

Field Detail

refreshableAtback to summary
pack-priv final long refreshableAt

Constructor Detail

RefreshableExpirableEntryback to summary
pack-priv RefreshableExpirableEntry(K key, V value, long snapshot, long expiresAt, long refreshableAt)

Method Detail

refreshableAtback to summary
public long refreshableAt()

Overrides com.github.benmanes.caffeine.cache.SnapshotEntry.refreshableAt.

Implements com.github.benmanes.caffeine.cache.Policy.CacheEntry.refreshableAt.

Doc from com.github.benmanes.caffeine.cache.Policy.CacheEntry.refreshableAt.

Returns the Ticker#read() ticks for when this entry becomes refreshable. If the cache was not configured with a refresh policy then this value is roughly Long#MAX_VALUE ticks away from the snapshotAt() reading.

Returns:long

the ticker reading for when the entry may be refreshed

Annotations
@Override
com.github.benmanes.caffeine.cache back to summary

pack-priv Class SnapshotEntry.WeightedEntry<K, V>

extends SnapshotEntry<K, V>
Class Inheritance
Known Direct Subclasses
com.github.benmanes.caffeine.cache.SnapshotEntry.ExpirableWeightedEntry

Field Summary

Modifier and TypeField and Description
pack-priv final int

Constructor Summary

AccessConstructor and Description
pack-priv
WeightedEntry(K key, V value, long snapshot, int weight)

Method Summary

Modifier and TypeMethod and Description
public int
Inherited from com.github.benmanes.caffeine.cache.SnapshotEntry:
equalsexpiresAtforEntryforEntrygetKeygetValuehashCoderefreshableAtsetValuesnapshotAttoString

Field Detail

weightback to summary
pack-priv final int weight

Constructor Detail

WeightedEntryback to summary
pack-priv WeightedEntry(K key, V value, long snapshot, int weight)

Method Detail

weightback to summary
public int weight()

Overrides com.github.benmanes.caffeine.cache.SnapshotEntry.weight.

Implements com.github.benmanes.caffeine.cache.Policy.CacheEntry.weight.

Doc from com.github.benmanes.caffeine.cache.Policy.CacheEntry.weight.

Returns the entry's weight. If the cache was not configured with a maximum weight then this value is always 1.

Returns:int

the weight if the entry

Annotations
@Override