Class References.WeakKeyReference<K>
java.lang.Object
java.lang.ref.Reference<K>
java.lang.ref.WeakReference<K>
com.github.benmanes.caffeine.cache.References.WeakKeyReference<K>
- All Implemented Interfaces:
References.InternalReference<K>
- Enclosing class:
References
static class References.WeakKeyReference<K>
extends WeakReference<K>
implements References.InternalReference<K>
The key in a cache that holds keys weakly. This class retains the key's identity hash code in
the advent that the key is reclaimed so that the entry can be removed from the cache in
constant time.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanReturns the key that is associated to the cache entry holding this reference.inthashCode()Methods inherited from class Reference
clear, clone, enqueue, get, isEnqueued, reachabilityFence, refersToMethods inherited from class Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface References.InternalReference
get, referenceEquals
-
Field Details
-
hashCode
private final int hashCode
-
-
Constructor Details
-
WeakKeyReference
-
-
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<K>- Returns:
- the key that is associated to the cached entry
-
equals
-
hashCode
-