Class PW<K,V>
- java.lang.Object
-
- com.github.benmanes.caffeine.cache.Node<K,V>
-
- com.github.benmanes.caffeine.cache.PW<K,V>
-
- All Implemented Interfaces:
AccessOrderDeque.AccessOrder<Node<K,V>>,NodeFactory<K,V>,WriteOrderDeque.WriteOrder<Node<K,V>>
class PW<K,V> extends Node<K,V> implements NodeFactory<K,V>
WARNING: GENERATED CODE A cache entry that provides the following features:- StrongKeys
- WeakValues
-
-
Field Summary
Fields Modifier and Type Field Description (package private) References.WeakValueReference<V>valueprotected static longVALUE_OFFSET-
Fields inherited from interface com.github.benmanes.caffeine.cache.NodeFactory
DEAD_STRONG_KEY, DEAD_WEAK_KEY, RETIRED_STRONG_KEY, RETIRED_WEAK_KEY
-
-
Constructor Summary
Constructors Constructor Description PW()PW(java.lang.Object keyReference, V value, java.lang.ref.ReferenceQueue<V> valueReferenceQueue, int weight, long now)PW(K key, java.lang.ref.ReferenceQueue<K> keyReferenceQueue, V value, java.lang.ref.ReferenceQueue<V> valueReferenceQueue, int weight, long now)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancontainsValue(java.lang.Object value)Returnstrueif the given objects are considered equivalent.voiddie()Sets the node to the dead state.KgetKey()Return the key ornullif it has been reclaimed by the garbage collector.java.lang.ObjectgetKeyReference()Returns the reference that the cache is holding the entry by.VgetValue()Return the value ornullif it has been reclaimed by the garbage collector.java.lang.ObjectgetValueReference()Returns the reference to the value.booleanisAlive()If the entry is available in the hash-table and page replacement policy.booleanisDead()If the entry was removed from the hash-table and the page replacement policy.booleanisRetired()If the entry was removed from the hash-table and is awaiting removal from the page replacement policy.Node<K,V>newNode(java.lang.Object keyReference, V value, java.lang.ref.ReferenceQueue<V> valueReferenceQueue, int weight, long now)Returns a node optimized for the specified features.Node<K,V>newNode(K key, java.lang.ref.ReferenceQueue<K> keyReferenceQueue, V value, java.lang.ref.ReferenceQueue<V> valueReferenceQueue, int weight, long now)Returns a node optimized for the specified features.voidretire()Sets the node to the retired state.voidsetValue(V value, java.lang.ref.ReferenceQueue<V> referenceQueue)Sets the value, which may be held strongly, weakly, or softly.booleanweakValues()Returns whether this factory supports weak values.-
Methods inherited from class com.github.benmanes.caffeine.cache.Node
casVariableTime, casWriteTime, getAccessTime, getNextInAccessOrder, getNextInVariableOrder, getNextInWriteOrder, getPolicyWeight, getPreviousInAccessOrder, getPreviousInVariableOrder, getPreviousInWriteOrder, getQueueType, getVariableTime, getWeight, getWriteTime, inMainProbation, inMainProtected, inWindow, makeMainProbation, makeMainProtected, makeWindow, setAccessTime, setNextInAccessOrder, setNextInVariableOrder, setNextInWriteOrder, setPolicyWeight, setPreviousInAccessOrder, setPreviousInVariableOrder, setPreviousInWriteOrder, setQueueType, setVariableTime, setWeight, setWriteTime, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.benmanes.caffeine.cache.NodeFactory
newLookupKey, newReferenceKey, softValues
-
-
-
-
Field Detail
-
VALUE_OFFSET
protected static final long VALUE_OFFSET
-
value
volatile References.WeakValueReference<V> value
-
-
Method Detail
-
getKeyReference
public final java.lang.Object getKeyReference()
Description copied from class:NodeReturns the reference that the cache is holding the entry by. This is either the key if strongly held or aWeakReferenceto that key.- Specified by:
getKeyReferencein classNode<K,V>
-
getKey
public final K getKey()
Description copied from class:NodeReturn the key ornullif it has been reclaimed by the garbage collector.
-
getValue
public final V getValue()
Description copied from class:NodeReturn the value ornullif it has been reclaimed by the garbage collector.
-
getValueReference
public final java.lang.Object getValueReference()
Description copied from class:NodeReturns the reference to the value. This is either the value if strongly held or aReferenceto that value.- Specified by:
getValueReferencein classNode<K,V>
-
setValue
public final void setValue(V value, java.lang.ref.ReferenceQueue<V> referenceQueue)
Description copied from class:NodeSets the value, which may be held strongly, weakly, or softly. This update may be set lazily and rely on the memory fence when the lock is released.
-
containsValue
public final boolean containsValue(java.lang.Object value)
Description copied from class:NodeReturnstrueif 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.- Specified by:
containsValuein classNode<K,V>
-
newNode
public Node<K,V> newNode(K key, java.lang.ref.ReferenceQueue<K> keyReferenceQueue, V value, java.lang.ref.ReferenceQueue<V> valueReferenceQueue, int weight, long now)
Description copied from interface:NodeFactoryReturns a node optimized for the specified features.- Specified by:
newNodein interfaceNodeFactory<K,V>
-
newNode
public Node<K,V> newNode(java.lang.Object keyReference, V value, java.lang.ref.ReferenceQueue<V> valueReferenceQueue, int weight, long now)
Description copied from interface:NodeFactoryReturns a node optimized for the specified features.- Specified by:
newNodein interfaceNodeFactory<K,V>
-
weakValues
public boolean weakValues()
Description copied from interface:NodeFactoryReturns whether this factory supports weak values.- Specified by:
weakValuesin interfaceNodeFactory<K,V>
-
isAlive
public final boolean isAlive()
Description copied from class:NodeIf the entry is available in the hash-table and page replacement policy.
-
isRetired
public final boolean isRetired()
Description copied from class:NodeIf the entry was removed from the hash-table and is awaiting removal from the page replacement policy.
-
retire
public final void retire()
Description copied from class:NodeSets the node to the retired state.
-
isDead
public final boolean isDead()
Description copied from class:NodeIf the entry was removed from the hash-table and the page replacement policy.
-
-