Package com.google.common.cache
Class LocalCache.WeakEntry<K,V>
java.lang.Object
java.lang.ref.Reference<K>
java.lang.ref.WeakReference<K>
com.google.common.cache.LocalCache.WeakEntry<K,V>
- All Implemented Interfaces:
ReferenceEntry<K,
V>
- Direct Known Subclasses:
LocalCache.WeakAccessEntry
,LocalCache.WeakAccessWriteEntry
,LocalCache.WeakWriteEntry
- Enclosing class:
LocalCache<K,
V>
Used for weakly-referenced keys.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final int
(package private) final ReferenceEntry
<K, V> (package private) LocalCache.ValueReference
<K, V> -
Constructor Summary
ConstructorsConstructorDescriptionWeakEntry
(ReferenceQueue<K> queue, K key, int hash, ReferenceEntry<K, V> next) -
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the time that this entry was last accessed, in ns.int
getHash()
Returns the entry's hash.getKey()
Returns the key for this entry.getNext()
Returns the next entry in the chain.Returns the next entry in the access queue.Returns the next entry in the write queue.Returns the previous entry in the access queue.Returns the previous entry in the write queue.Returns the value reference from this entry.long
void
setAccessTime
(long time) Sets the entry access time in ns.void
setNextInAccessQueue
(ReferenceEntry<K, V> next) Sets the next entry in the access queue.void
setNextInWriteQueue
(ReferenceEntry<K, V> next) Sets the next entry in the write queue.void
setPreviousInAccessQueue
(ReferenceEntry<K, V> previous) Sets the previous entry in the access queue.void
setPreviousInWriteQueue
(ReferenceEntry<K, V> previous) Sets the previous entry in the write queue.void
setValueReference
(LocalCache.ValueReference<K, V> valueReference) Sets the value reference for this entry.void
setWriteTime
(long time) Sets the entry write time in ns.Methods inherited from class java.lang.ref.Reference
clear, clone, enqueue, get, isEnqueued, reachabilityFence, refersTo
-
Field Details
-
hash
final int hash -
next
-
valueReference
-
-
Constructor Details
-
WeakEntry
WeakEntry(ReferenceQueue<K> queue, K key, int hash, @CheckForNull ReferenceEntry<K, V> next)
-
-
Method Details
-
getKey
Description copied from interface:ReferenceEntry
Returns the key for this entry.- Specified by:
getKey
in interfaceReferenceEntry<K,
V>
-
getAccessTime
public long getAccessTime()Description copied from interface:ReferenceEntry
Returns the time that this entry was last accessed, in ns.- Specified by:
getAccessTime
in interfaceReferenceEntry<K,
V>
-
setAccessTime
public void setAccessTime(long time) Description copied from interface:ReferenceEntry
Sets the entry access time in ns.- Specified by:
setAccessTime
in interfaceReferenceEntry<K,
V>
-
getNextInAccessQueue
Description copied from interface:ReferenceEntry
Returns the next entry in the access queue.- Specified by:
getNextInAccessQueue
in interfaceReferenceEntry<K,
V>
-
setNextInAccessQueue
Description copied from interface:ReferenceEntry
Sets the next entry in the access queue.- Specified by:
setNextInAccessQueue
in interfaceReferenceEntry<K,
V>
-
getPreviousInAccessQueue
Description copied from interface:ReferenceEntry
Returns the previous entry in the access queue.- Specified by:
getPreviousInAccessQueue
in interfaceReferenceEntry<K,
V>
-
setPreviousInAccessQueue
Description copied from interface:ReferenceEntry
Sets the previous entry in the access queue.- Specified by:
setPreviousInAccessQueue
in interfaceReferenceEntry<K,
V>
-
getWriteTime
public long getWriteTime()- Specified by:
getWriteTime
in interfaceReferenceEntry<K,
V>
-
setWriteTime
public void setWriteTime(long time) Description copied from interface:ReferenceEntry
Sets the entry write time in ns.- Specified by:
setWriteTime
in interfaceReferenceEntry<K,
V>
-
getNextInWriteQueue
Description copied from interface:ReferenceEntry
Returns the next entry in the write queue.- Specified by:
getNextInWriteQueue
in interfaceReferenceEntry<K,
V>
-
setNextInWriteQueue
Description copied from interface:ReferenceEntry
Sets the next entry in the write queue.- Specified by:
setNextInWriteQueue
in interfaceReferenceEntry<K,
V>
-
getPreviousInWriteQueue
Description copied from interface:ReferenceEntry
Returns the previous entry in the write queue.- Specified by:
getPreviousInWriteQueue
in interfaceReferenceEntry<K,
V>
-
setPreviousInWriteQueue
Description copied from interface:ReferenceEntry
Sets the previous entry in the write queue.- Specified by:
setPreviousInWriteQueue
in interfaceReferenceEntry<K,
V>
-
getValueReference
Description copied from interface:ReferenceEntry
Returns the value reference from this entry.- Specified by:
getValueReference
in interfaceReferenceEntry<K,
V>
-
setValueReference
Description copied from interface:ReferenceEntry
Sets the value reference for this entry.- Specified by:
setValueReference
in interfaceReferenceEntry<K,
V>
-
getHash
public int getHash()Description copied from interface:ReferenceEntry
Returns the entry's hash.- Specified by:
getHash
in interfaceReferenceEntry<K,
V>
-
getNext
Description copied from interface:ReferenceEntry
Returns the next entry in the chain.- Specified by:
getNext
in interfaceReferenceEntry<K,
V>
-