Class References.SoftValueReference<V>
java.lang.Object
java.lang.ref.Reference<V>
java.lang.ref.SoftReference<V>
com.github.benmanes.caffeine.cache.References.SoftValueReference<V>
- All Implemented Interfaces:
References.InternalReference<V>
- Enclosing class:
References
static final class References.SoftValueReference<V>
extends SoftReference<V>
implements References.InternalReference<V>
The value in a cache that holds values softly. This class retains a reference to the key in
the advent that the value is reclaimed so that the entry can be removed from the cache in
constant time.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionSoftValueReference(@NonNull Object keyReference, @Nullable V value, @Nullable ReferenceQueue<V> queue) -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the key that is associated to the cache entry holding this reference.inthashCode()voidsetKeyReference(Object keyReference) Methods inherited from class SoftReference
getMethods inherited from class Reference
clear, clone, enqueue, isEnqueued, reachabilityFence, refersToMethods inherited from class Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface References.InternalReference
get, referenceEquals
-
Field Details
-
keyReference
-
-
Constructor Details
-
SoftValueReference
public SoftValueReference(@NonNull Object keyReference, @Nullable V value, @Nullable ReferenceQueue<V> queue)
-
-
Method Details
-
getKeyReference
Description copied from interface:References.InternalReferenceReturns the key that is associated to the cache entry holding this reference. If the cache holds keys strongly, this is that key instance. Otherwise the cache holds keys weakly and theReferences.WeakKeyReferenceis returned.- Specified by:
getKeyReferencein interfaceReferences.InternalReference<V>- Returns:
- the key that is associated to the cached entry
-
setKeyReference
-
equals
-
hashCode
-