Class LocalCache.WriteQueue<K,​V>

  • All Implemented Interfaces:
    java.lang.Iterable<LocalCache.ReferenceEntry<K,​V>>, java.util.Collection<LocalCache.ReferenceEntry<K,​V>>, java.util.Queue<LocalCache.ReferenceEntry<K,​V>>
    Enclosing class:
    LocalCache<K,​V>

    static final class LocalCache.WriteQueue<K,​V>
    extends java.util.AbstractQueue<LocalCache.ReferenceEntry<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.

    • Constructor Summary

      Constructors 
      Constructor Description
      WriteQueue()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clear()  
      boolean contains​(java.lang.Object o)  
      boolean isEmpty()  
      java.util.Iterator<LocalCache.ReferenceEntry<K,​V>> iterator()  
      boolean offer​(LocalCache.ReferenceEntry<K,​V> entry)  
      LocalCache.ReferenceEntry<K,​V> peek()  
      LocalCache.ReferenceEntry<K,​V> poll()  
      boolean remove​(java.lang.Object o)  
      int size()  
      • 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
      • Methods inherited from interface java.lang.Iterable

        forEach