Class NodeFactory.WSo<K,V>
- java.lang.Object
-
- com.github.benmanes.caffeine.cache.NodeFactory.WSo<K,V>
-
- All Implemented Interfaces:
AccessOrderDeque.AccessOrder<Node<K,V>>,Node<K,V>,WriteOrderDeque.WriteOrder<Node<K,V>>
- Direct Known Subclasses:
NodeFactory.WSoA,NodeFactory.WSoMS,NodeFactory.WSoMW,NodeFactory.WSoR,NodeFactory.WSoW
- Enclosing class:
- NodeFactory
static class NodeFactory.WSo<K,V> extends java.lang.Object implements Node<K,V>
-
-
Field Summary
Fields Modifier and Type Field Description private References.WeakKeyReference<K>keyprotected static longKEY_OFFSETprivate References.SoftValueReference<V>valueprotected static longVALUE_OFFSET
-
Constructor Summary
Constructors Constructor Description WSo(java.lang.Object keyReference, V value, java.lang.ref.ReferenceQueue<V> valueReferenceQueue, int weight, long now)WSo(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.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.java.lang.StringtoString()-
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.Node
casWriteTime, getAccessTime, getNextInAccessOrder, getNextInWriteOrder, getPolicyWeight, getPreviousInAccessOrder, getPreviousInWriteOrder, getQueueType, getWeight, getWriteTime, inEden, inMainProbation, inMainProtected, makeMainProbation, makeMainProtected, setAccessTime, setNextInAccessOrder, setNextInWriteOrder, setPolicyWeight, setPreviousInAccessOrder, setPreviousInWriteOrder, setQueueType, setWeight, setWriteTime
-
-
-
-
Field Detail
-
KEY_OFFSET
protected static final long KEY_OFFSET
-
VALUE_OFFSET
protected static final long VALUE_OFFSET
-
key
private volatile References.WeakKeyReference<K> key
-
value
private volatile References.SoftValueReference<V> value
-
-
Method Detail
-
getKey
public final K getKey()
Description copied from interface:NodeReturn the key ornullif it has been reclaimed by the garbage collector.
-
getKeyReference
public final java.lang.Object getKeyReference()
Description copied from interface: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 interfaceNode<K,V>
-
getValue
public final V getValue()
Description copied from interface:NodeReturn the value ornullif it has been reclaimed by the garbage collector.
-
getValueReference
public final java.lang.Object getValueReference()
Description copied from interface:NodeReturns the reference to the value. This is either the value if strongly held or aReferenceto that value.- Specified by:
getValueReferencein interfaceNode<K,V>
-
setValue
public final void setValue(V value, java.lang.ref.ReferenceQueue<V> referenceQueue)
Description copied from interface: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 interface: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 interfaceNode<K,V>
-
isAlive
public final boolean isAlive()
Description copied from interface:NodeIf the entry is available in the hash-table and page replacement policy.
-
isRetired
public final boolean isRetired()
Description copied from interface: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 interface:NodeSets the node to the retired state.
-
isDead
public final boolean isDead()
Description copied from interface:NodeIf the entry was removed from the hash-table and the page replacement policy.
-
die
public final void die()
Description copied from interface:NodeSets the node to the dead state.
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-