Class References.WeakValueReference<V>
- java.lang.Object
-
- java.lang.ref.Reference<T>
-
- java.lang.ref.WeakReference<V>
-
- com.github.benmanes.caffeine.cache.References.WeakValueReference<V>
-
- All Implemented Interfaces:
References.InternalReference<V>
- Enclosing class:
- References
static final class References.WeakValueReference<V> extends java.lang.ref.WeakReference<V> implements References.InternalReference<V>
The value in a cache that holds values weakly. 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 Modifier and Type Field Description private java.lang.Object
keyReference
-
Constructor Summary
Constructors Constructor Description WeakValueReference(java.lang.Object keyReference, V value, java.lang.ref.ReferenceQueue<V> queue)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object object)
java.lang.Object
getKeyReference()
Returns the key that is associated to the cache entry holding this reference.int
hashCode()
-
Methods inherited from class java.lang.ref.Reference
clear, clone, enqueue, get, isEnqueued, reachabilityFence
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.github.benmanes.caffeine.cache.References.InternalReference
get, referenceEquals
-
-
-
-
Method Detail
-
getKeyReference
public java.lang.Object getKeyReference()
Description copied from interface:References.InternalReference
Returns 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.WeakKeyReference
is returned.- Specified by:
getKeyReference
in interfaceReferences.InternalReference<V>
- Returns:
- the key that is associated to the cached entry
-
equals
public boolean equals(java.lang.Object object)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
-