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

pack-priv abstract Class Node<K, V>

extends Object
implements AccessOrderDeque.AccessOrder<Node<K, V>>, WriteOrderDeque.WriteOrder<Node<K, V>>
Class Inheritance
All Implemented Interfaces
com.github.benmanes.caffeine.cache.WriteOrderDeque.WriteOrder, com.github.benmanes.caffeine.cache.AccessOrderDeque.AccessOrder
Known Direct Subclasses
com.github.benmanes.caffeine.cache.TimerWheel.Sentinel, com.github.benmanes.caffeine.cache.Interned
Static Imports
java.util.Locale.US

An entry in the cache containing the key, value, weight, access, and write metadata. The key or value may be held weakly or softly requiring identity comparison.
Author
[email protected] (Ben Manes)

Field Summary

Modifier and TypeField and Description
public static final int
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
pack-priv
Node()

Method Summary

Modifier and TypeMethod and Description
public boolean
casVariableTime(long expect, long update)

Atomically sets the variable time to the given updated value if the current value equals the expected value and returns if the update was successful.

public boolean
casWriteTime(long expect, long update)

Atomically sets the write-time to the given updated value if the current value equals the expected value and returns if the update was successful.

public abstract boolean
containsValue(Object value)

Returns true if the given objects are considered equivalent.

public abstract void
die()

Sets the node to the dead state.

public long
getAccessTime()

Returns the time that this entry was last accessed, in ns.

public abstract @Nullable K
getKey()

Return the key or null if it has been reclaimed by the garbage collector.

public abstract Object
getKeyReference()

Returns the reference that the cache is holding the entry by.

public @Nullable Node<K, V>
getNextInAccessOrder()

Implements com.github.benmanes.caffeine.cache.AccessOrderDeque.AccessOrder.getNextInAccessOrder.

Retrieves the next element or null if either the element is unlinked or the last element on the deque.
public Node<K, V>
public @Nullable Node<K, V>
getNextInWriteOrder()

Implements com.github.benmanes.caffeine.cache.WriteOrderDeque.WriteOrder.getNextInWriteOrder.

Retrieves the next element or null if either the element is unlinked or the last element on the deque.
public @NonNegative int
getPolicyWeight()

Returns the weight of this entry from the policy's perspective.

public @Nullable Node<K, V>
getPreviousInAccessOrder()

Implements com.github.benmanes.caffeine.cache.AccessOrderDeque.AccessOrder.getPreviousInAccessOrder.

Retrieves the previous element or null if either the element is unlinked or the first element on the deque.
public Node<K, V>
public @Nullable Node<K, V>
getPreviousInWriteOrder()

Implements com.github.benmanes.caffeine.cache.WriteOrderDeque.WriteOrder.getPreviousInWriteOrder.

Retrieves the previous element or null if either the element is unlinked or the first element on the deque.
public int
getQueueType()

Returns the queue that the entry's resides in (window, probation, or protected).

public abstract @Nullable V
getValue()

Return the value or null if it has been reclaimed by the garbage collector.

public abstract Object
getValueReference()

Returns the reference to the value.

public long
getVariableTime()

Returns the variable expiration time, in nanoseconds.

public @NonNegative int
getWeight()

Returns the weight of this entry from the entry's perspective.

public long
getWriteTime()

Returns the time that this entry was last written, in ns.

public boolean
inMainProbation()

Returns if the entry is in the Main space's probation queue.

public boolean
inMainProtected()

Returns if the entry is in the Main space's protected queue.

public boolean
inWindow()

Returns if the entry is in the Window or Main space.

public abstract boolean
isAlive()

If the entry is available in the hash-table and page replacement policy.

public abstract boolean
isDead()

If the entry was removed from the hash-table and the page replacement policy.

public abstract boolean
isRetired()

If the entry was removed from the hash-table and is awaiting removal from the page replacement policy.

public void
makeMainProbation()

Sets the status to the Main space's probation queue.

public void
makeMainProtected()

Sets the status to the Main space's protected queue.

public void
makeWindow()

Sets the status to the Window queue.

public abstract void
retire()

Sets the node to the retired state.

public void
setAccessTime(long time)

Sets the access time in nanoseconds.

public void
public void
public void
public void
setPolicyWeight(@NonNegative int weight)

Sets the weight from the policy's perspective.

public void
public void
public void
public void
setQueueType(int queueType)

Set queue that the entry resides in (window, probation, or protected).

public abstract void
setValue(V value, @Nullable ReferenceQueue<V> referenceQueue)

Sets the value, which may be held strongly, weakly, or softly.

public void
setVariableTime(long time)

Sets the variable expiration time in nanoseconds.

public void
setWeight(@NonNegative int weight)

Sets the weight from the entry's perspective.

public void
setWriteTime(long time)

Sets the write-time in nanoseconds.

public final String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

PROBATIONback to summary
public static final int PROBATION
PROTECTEDback to summary
public static final int PROTECTED
WINDOWback to summary
public static final int WINDOW

Constructor Detail

Nodeback to summary
pack-priv Node()

Method Detail

casVariableTimeback to summary
public boolean casVariableTime(long expect, long update)

Atomically sets the variable time to the given updated value if the current value equals the expected value and returns if the update was successful.

casWriteTimeback to summary
public boolean casWriteTime(long expect, long update)

Atomically sets the write-time to the given updated value if the current value equals the expected value and returns if the update was successful.

containsValueback to summary
public abstract boolean containsValue(Object value)

Returns true if the given objects are considered equivalent. A strongly held value is compared by equality and a weakly or softly held value is compared by identity.

dieback to summary
public abstract void die()

Sets the node to the dead state.

Annotations
@GuardedBy:this
getAccessTimeback to summary
public long getAccessTime()

Returns the time that this entry was last accessed, in ns.

getKeyback to summary
public abstract @Nullable K getKey()

Return the key or null if it has been reclaimed by the garbage collector.

getKeyReferenceback to summary
public abstract Object getKeyReference()

Returns the reference that the cache is holding the entry by. This is either the key if strongly held or a java.lang.ref.WeakReference to that key.

getNextInAccessOrderback to summary
public @Nullable Node<K, V> getNextInAccessOrder()

Implements com.github.benmanes.caffeine.cache.AccessOrderDeque.AccessOrder.getNextInAccessOrder.

Doc from com.github.benmanes.caffeine.cache.AccessOrderDeque.AccessOrder.getNextInAccessOrder.

Retrieves the next element or null if either the element is unlinked or the last element on the deque.

Annotations
@Override
getNextInVariableOrderback to summary
public Node<K, V> getNextInVariableOrder()
getNextInWriteOrderback to summary
public @Nullable Node<K, V> getNextInWriteOrder()

Implements com.github.benmanes.caffeine.cache.WriteOrderDeque.WriteOrder.getNextInWriteOrder.

Doc from com.github.benmanes.caffeine.cache.WriteOrderDeque.WriteOrder.getNextInWriteOrder.

Retrieves the next element or null if either the element is unlinked or the last element on the deque.

Annotations
@Override
getPolicyWeightback to summary
public @NonNegative int getPolicyWeight()

Returns the weight of this entry from the policy's perspective.

getPreviousInAccessOrderback to summary
public @Nullable Node<K, V> getPreviousInAccessOrder()

Implements com.github.benmanes.caffeine.cache.AccessOrderDeque.AccessOrder.getPreviousInAccessOrder.

Doc from com.github.benmanes.caffeine.cache.AccessOrderDeque.AccessOrder.getPreviousInAccessOrder.

Retrieves the previous element or null if either the element is unlinked or the first element on the deque.

Annotations
@Override
getPreviousInVariableOrderback to summary
public Node<K, V> getPreviousInVariableOrder()
getPreviousInWriteOrderback to summary
public @Nullable Node<K, V> getPreviousInWriteOrder()

Implements com.github.benmanes.caffeine.cache.WriteOrderDeque.WriteOrder.getPreviousInWriteOrder.

Doc from com.github.benmanes.caffeine.cache.WriteOrderDeque.WriteOrder.getPreviousInWriteOrder.

Retrieves the previous element or null if either the element is unlinked or the first element on the deque.

Annotations
@Override
getQueueTypeback to summary
public int getQueueType()

Returns the queue that the entry's resides in (window, probation, or protected).

getValueback to summary
public abstract @Nullable V getValue()

Return the value or null if it has been reclaimed by the garbage collector.

getValueReferenceback to summary
public abstract Object getValueReference()

Returns the reference to the value. This is either the value if strongly held or a java.lang.ref.Reference to that value.

getVariableTimeback to summary
public long getVariableTime()

Returns the variable expiration time, in nanoseconds.

getWeightback to summary
public @NonNegative int getWeight()

Returns the weight of this entry from the entry's perspective.

Annotations
@GuardedBy:this
getWriteTimeback to summary
public long getWriteTime()

Returns the time that this entry was last written, in ns.

inMainProbationback to summary
public boolean inMainProbation()

Returns if the entry is in the Main space's probation queue.

inMainProtectedback to summary
public boolean inMainProtected()

Returns if the entry is in the Main space's protected queue.

inWindowback to summary
public boolean inWindow()

Returns if the entry is in the Window or Main space.

isAliveback to summary
public abstract boolean isAlive()

If the entry is available in the hash-table and page replacement policy.

isDeadback to summary
public abstract boolean isDead()

If the entry was removed from the hash-table and the page replacement policy.

Annotations
@GuardedBy:this
isRetiredback to summary
public abstract boolean isRetired()

If the entry was removed from the hash-table and is awaiting removal from the page replacement policy.

Annotations
@GuardedBy:this
makeMainProbationback to summary
public void makeMainProbation()

Sets the status to the Main space's probation queue.

makeMainProtectedback to summary
public void makeMainProtected()

Sets the status to the Main space's protected queue.

makeWindowback to summary
public void makeWindow()

Sets the status to the Window queue.

retireback to summary
public abstract void retire()

Sets the node to the retired state.

Annotations
@GuardedBy:this
setAccessTimeback to summary
public void setAccessTime(long time)

Sets the access time in nanoseconds. This update may be set lazily and rely on the memory fence when the lock is released.

setNextInAccessOrderback to summary
public void setNextInAccessOrder(@Nullable Node<K, V> next)
Annotations
@Override
setNextInVariableOrderback to summary
public void setNextInVariableOrder(@Nullable Node<K, V> prev)
setNextInWriteOrderback to summary
public void setNextInWriteOrder(@Nullable Node<K, V> next)
Annotations
@Override
setPolicyWeightback to summary
public void setPolicyWeight(@NonNegative int weight)

Sets the weight from the policy's perspective.

setPreviousInAccessOrderback to summary
public void setPreviousInAccessOrder(@Nullable Node<K, V> prev)
Annotations
@Override
setPreviousInVariableOrderback to summary
public void setPreviousInVariableOrder(@Nullable Node<K, V> prev)
setPreviousInWriteOrderback to summary
public void setPreviousInWriteOrder(@Nullable Node<K, V> prev)
Annotations
@Override
setQueueTypeback to summary
public void setQueueType(int queueType)

Set queue that the entry resides in (window, probation, or protected).

setValueback to summary
public abstract void setValue(V value, @Nullable ReferenceQueue<V> referenceQueue)

Sets the value, which may be held strongly, weakly, or softly.

Annotations
@GuardedBy:this
setVariableTimeback to summary
public void setVariableTime(long time)

Sets the variable expiration time in nanoseconds. This update may be set lazily and rely on the memory fence when the lock is released.

setWeightback to summary
public void setWeight(@NonNegative int weight)

Sets the weight from the entry's perspective.

Annotations
@GuardedBy:this
setWriteTimeback to summary
public void setWriteTime(long time)

Sets the write-time in nanoseconds. This update may be set lazily and rely on the memory fence when the lock is released.

toStringback to summary
public final 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
@SuppressWarnings:GuardedBy