Package com.google.common.cache
Class LocalCache.WeakEntry<K,V>
- java.lang.Object
-
- java.lang.ref.Reference<T>
-
- java.lang.ref.WeakReference<K>
-
- com.google.common.cache.LocalCache.WeakEntry<K,V>
-
- All Implemented Interfaces:
LocalCache.ReferenceEntry<K,V>
- Direct Known Subclasses:
LocalCache.WeakAccessEntry
,LocalCache.WeakAccessWriteEntry
,LocalCache.WeakWriteEntry
- Enclosing class:
- LocalCache<K,V>
static class LocalCache.WeakEntry<K,V> extends java.lang.ref.WeakReference<K> implements LocalCache.ReferenceEntry<K,V>
Used for weakly-referenced keys.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) int
hash
(package private) LocalCache.ReferenceEntry<K,V>
next
(package private) LocalCache.ValueReference<K,V>
valueReference
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getAccessTime()
Returns the time that this entry was last accessed, in ns.int
getHash()
Returns the entry's hash.K
getKey()
Returns the key for this entry.LocalCache.ReferenceEntry<K,V>
getNext()
Returns the next entry in the chain.LocalCache.ReferenceEntry<K,V>
getNextInAccessQueue()
Returns the next entry in the access queue.LocalCache.ReferenceEntry<K,V>
getNextInWriteQueue()
Returns the next entry in the write queue.LocalCache.ReferenceEntry<K,V>
getPreviousInAccessQueue()
Returns the previous entry in the access queue.LocalCache.ReferenceEntry<K,V>
getPreviousInWriteQueue()
Returns the previous entry in the write queue.LocalCache.ValueReference<K,V>
getValueReference()
Returns the value reference from this entry.long
getWriteTime()
Returns the time that this entry was last written, in ns.void
setAccessTime(long time)
Sets the entry access time in ns.void
setNextInAccessQueue(LocalCache.ReferenceEntry<K,V> next)
Sets the next entry in the access queue.void
setNextInWriteQueue(LocalCache.ReferenceEntry<K,V> next)
Sets the next entry in the write queue.void
setPreviousInAccessQueue(LocalCache.ReferenceEntry<K,V> previous)
Sets the previous entry in the access queue.void
setPreviousInWriteQueue(LocalCache.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.
-
-
-
Field Detail
-
hash
final int hash
-
next
final LocalCache.ReferenceEntry<K,V> next
-
valueReference
volatile LocalCache.ValueReference<K,V> valueReference
-
-
Constructor Detail
-
WeakEntry
WeakEntry(java.lang.ref.ReferenceQueue<K> queue, K key, int hash, @Nullable LocalCache.ReferenceEntry<K,V> next)
-
-
Method Detail
-
getKey
public K getKey()
Description copied from interface:LocalCache.ReferenceEntry
Returns the key for this entry.- Specified by:
getKey
in interfaceLocalCache.ReferenceEntry<K,V>
-
getAccessTime
public long getAccessTime()
Description copied from interface:LocalCache.ReferenceEntry
Returns the time that this entry was last accessed, in ns.- Specified by:
getAccessTime
in interfaceLocalCache.ReferenceEntry<K,V>
-
setAccessTime
public void setAccessTime(long time)
Description copied from interface:LocalCache.ReferenceEntry
Sets the entry access time in ns.- Specified by:
setAccessTime
in interfaceLocalCache.ReferenceEntry<K,V>
-
getNextInAccessQueue
public LocalCache.ReferenceEntry<K,V> getNextInAccessQueue()
Description copied from interface:LocalCache.ReferenceEntry
Returns the next entry in the access queue.- Specified by:
getNextInAccessQueue
in interfaceLocalCache.ReferenceEntry<K,V>
-
setNextInAccessQueue
public void setNextInAccessQueue(LocalCache.ReferenceEntry<K,V> next)
Description copied from interface:LocalCache.ReferenceEntry
Sets the next entry in the access queue.- Specified by:
setNextInAccessQueue
in interfaceLocalCache.ReferenceEntry<K,V>
-
getPreviousInAccessQueue
public LocalCache.ReferenceEntry<K,V> getPreviousInAccessQueue()
Description copied from interface:LocalCache.ReferenceEntry
Returns the previous entry in the access queue.- Specified by:
getPreviousInAccessQueue
in interfaceLocalCache.ReferenceEntry<K,V>
-
setPreviousInAccessQueue
public void setPreviousInAccessQueue(LocalCache.ReferenceEntry<K,V> previous)
Description copied from interface:LocalCache.ReferenceEntry
Sets the previous entry in the access queue.- Specified by:
setPreviousInAccessQueue
in interfaceLocalCache.ReferenceEntry<K,V>
-
getWriteTime
public long getWriteTime()
Description copied from interface:LocalCache.ReferenceEntry
Returns the time that this entry was last written, in ns.- Specified by:
getWriteTime
in interfaceLocalCache.ReferenceEntry<K,V>
-
setWriteTime
public void setWriteTime(long time)
Description copied from interface:LocalCache.ReferenceEntry
Sets the entry write time in ns.- Specified by:
setWriteTime
in interfaceLocalCache.ReferenceEntry<K,V>
-
getNextInWriteQueue
public LocalCache.ReferenceEntry<K,V> getNextInWriteQueue()
Description copied from interface:LocalCache.ReferenceEntry
Returns the next entry in the write queue.- Specified by:
getNextInWriteQueue
in interfaceLocalCache.ReferenceEntry<K,V>
-
setNextInWriteQueue
public void setNextInWriteQueue(LocalCache.ReferenceEntry<K,V> next)
Description copied from interface:LocalCache.ReferenceEntry
Sets the next entry in the write queue.- Specified by:
setNextInWriteQueue
in interfaceLocalCache.ReferenceEntry<K,V>
-
getPreviousInWriteQueue
public LocalCache.ReferenceEntry<K,V> getPreviousInWriteQueue()
Description copied from interface:LocalCache.ReferenceEntry
Returns the previous entry in the write queue.- Specified by:
getPreviousInWriteQueue
in interfaceLocalCache.ReferenceEntry<K,V>
-
setPreviousInWriteQueue
public void setPreviousInWriteQueue(LocalCache.ReferenceEntry<K,V> previous)
Description copied from interface:LocalCache.ReferenceEntry
Sets the previous entry in the write queue.- Specified by:
setPreviousInWriteQueue
in interfaceLocalCache.ReferenceEntry<K,V>
-
getValueReference
public LocalCache.ValueReference<K,V> getValueReference()
Description copied from interface:LocalCache.ReferenceEntry
Returns the value reference from this entry.- Specified by:
getValueReference
in interfaceLocalCache.ReferenceEntry<K,V>
-
setValueReference
public void setValueReference(LocalCache.ValueReference<K,V> valueReference)
Description copied from interface:LocalCache.ReferenceEntry
Sets the value reference for this entry.- Specified by:
setValueReference
in interfaceLocalCache.ReferenceEntry<K,V>
-
getHash
public int getHash()
Description copied from interface:LocalCache.ReferenceEntry
Returns the entry's hash.- Specified by:
getHash
in interfaceLocalCache.ReferenceEntry<K,V>
-
getNext
public LocalCache.ReferenceEntry<K,V> getNext()
Description copied from interface:LocalCache.ReferenceEntry
Returns the next entry in the chain.- Specified by:
getNext
in interfaceLocalCache.ReferenceEntry<K,V>
-
-