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, remove
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toArray, toArray, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods 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:
remove
in interfaceCollection<K>
- Overrides:
remove
in classAbstractCollection<ReferenceEntry<K,
V>>
-
contains
- Specified by:
contains
in interfaceCollection<K>
- Overrides:
contains
in classAbstractCollection<ReferenceEntry<K,
V>>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<K>
- Overrides:
isEmpty
in classAbstractCollection<ReferenceEntry<K,
V>>
-
size
public int size()- Specified by:
size
in interfaceCollection<K>
- Specified by:
size
in classAbstractCollection<ReferenceEntry<K,
V>>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<K>
- Overrides:
clear
in classAbstractQueue<ReferenceEntry<K,
V>>
-
iterator
- Specified by:
iterator
in interfaceCollection<K>
- Specified by:
iterator
in interfaceIterable<K>
- Specified by:
iterator
in classAbstractCollection<ReferenceEntry<K,
V>>
-