Package com.google.common.cache
Class LocalCache.WriteQueue<K,V>
- All Implemented Interfaces:
Iterable<ReferenceEntry<K,,V>> Collection<ReferenceEntry<K,,V>> Queue<ReferenceEntry<K,V>>
- Enclosing class:
- LocalCache<K,
V>
A custom queue for managing eviction order. Note that this is tightly integrated with
ReferenceEntry, upon which it relies to perform its linking.
Note that this entire implementation makes the assumption that all elements which are in the map are also in this queue, and that all elements not in the queue are not in the map.
The benefits of creating our own queue are that (1) we can replace elements in the middle of the queue as part of copyWriteEntry, and (2) the contains method is highly optimized for the current model.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.AbstractQueue
add, addAll, element, removeMethods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toArray, toArray, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Collection
containsAll, equals, hashCode, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
Field Details
-
head
-
-
Constructor Details
-
WriteQueue
WriteQueue()
-
-
Method Details
-
offer
-
peek
-
poll
-
remove
- Specified by:
removein interfaceCollection<K>- Overrides:
removein classAbstractCollection<ReferenceEntry<K,V>>
-
contains
- Specified by:
containsin interfaceCollection<K>- Overrides:
containsin classAbstractCollection<ReferenceEntry<K,V>>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<K>- Overrides:
isEmptyin classAbstractCollection<ReferenceEntry<K,V>>
-
size
public int size()- Specified by:
sizein interfaceCollection<K>- Specified by:
sizein classAbstractCollection<ReferenceEntry<K,V>>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<K>- Overrides:
clearin classAbstractQueue<ReferenceEntry<K,V>>
-
iterator
- Specified by:
iteratorin interfaceCollection<K>- Specified by:
iteratorin interfaceIterable<K>- Specified by:
iteratorin classAbstractCollection<ReferenceEntry<K,V>>
-