Class BoundedConcurrentHashMap.LIRSHashEntry<K,V>

java.lang.Object
io.debezium.util.BoundedConcurrentHashMap.HashEntry<K,V>
io.debezium.util.BoundedConcurrentHashMap.LIRSHashEntry<K,V>
Enclosing class:
BoundedConcurrentHashMap<K,V>

private static final class BoundedConcurrentHashMap.LIRSHashEntry<K,V> extends BoundedConcurrentHashMap.HashEntry<K,V>
Adapted to Infinispan BoundedConcurrentHashMap using LIRS implementation ideas from Charles Fry ([email protected]) See http://code.google.com/p/concurrentlinkedhashmap/source/browse/trunk/src/test/java/com/googlecode/concurrentlinkedhashmap/caches/LirsMap.java for original sources
  • Field Details

  • Constructor Details

  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class BoundedConcurrentHashMap.HashEntry<K,V>
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class BoundedConcurrentHashMap.HashEntry<K,V>
    • inStack

      public boolean inStack()
      Returns true if this entry is in the stack, false otherwise.
    • inQueue

      public boolean inQueue()
      Returns true if this entry is in the queue, false otherwise.
    • hit

      public void hit(Set<BoundedConcurrentHashMap.HashEntry<K,V>> evicted)
      Records a cache hit.
    • hotHit

      private void hotHit(Set<BoundedConcurrentHashMap.HashEntry<K,V>> evicted)
      Records a cache hit on a hot block.
    • coldHit

      private void coldHit(Set<BoundedConcurrentHashMap.HashEntry<K,V>> evicted)
      Records a cache hit on a cold block.
    • miss

      Records a cache miss. This is how new entries join the LIRS stack and queue. This is called both when a new entry is first created, and when a non-resident entry is re-computed.
    • warmupMiss

      private void warmupMiss()
      Records a miss when the hot entry set is not full.
    • fullMiss

      private void fullMiss(Set<BoundedConcurrentHashMap.HashEntry<K,V>> evicted)
      Records a miss when the hot entry set is full.
    • hot

      private void hot()
      Marks this entry as hot.
    • cold

      private void cold()
      Marks this entry as cold.
    • nonResident

      private void nonResident()
      Marks this entry as non-resident.
    • isResident

      public boolean isResident()
      Returns true if this entry is resident in the cache, false otherwise.
    • tempRemoveFromStack

      private void tempRemoveFromStack()
      Temporarily removes this entry from the stack, fixing up neighbor links. This entry's links remain unchanged, meaning that inStack() will continue to return true. This should only be called if this node's links will be subsequently changed.
    • removeFromStack

      private void removeFromStack()
      Removes this entry from the stack.
    • addToStackBefore

      private void addToStackBefore(BoundedConcurrentHashMap.LIRSHashEntry<K,V> existingEntry)
      Inserts this entry before the specified existing entry in the stack.
    • moveToStackTop

      private void moveToStackTop()
      Moves this entry to the top of the stack.
    • moveToStackBottom

      private void moveToStackBottom()
      Moves this entry to the bottom of the stack.
    • tempRemoveFromQueue

      private void tempRemoveFromQueue()
      Temporarily removes this entry from the queue, fixing up neighbor links. This entry's links remain unchanged. This should only be called if this node's links will be subsequently changed.
    • removeFromQueue

      private void removeFromQueue()
      Removes this entry from the queue.
    • addToQueueBefore

      private void addToQueueBefore(BoundedConcurrentHashMap.LIRSHashEntry<K,V> existingEntry)
      Inserts this entry before the specified existing entry in the queue.
    • moveToQueueEnd

      private void moveToQueueEnd()
      Moves this entry to the end of the queue.
    • migrateToQueue

      private void migrateToQueue()
      Moves this entry from the stack to the queue, marking it cold (as hot entries must remain in the stack). This should only be called on resident entries, as non-resident entries should not be made resident. The bottom entry on the queue is always hot due to stack pruning.
    • migrateToStack

      private void migrateToStack()
      Moves this entry from the queue to the stack, marking it hot (as cold resident entries must remain in the queue).
    • evict

      private void evict()
      Evicts this entry, removing it from the queue and setting its status to cold non-resident. If the entry is already absent from the stack, it is removed from the backing map; otherwise it remains in order for its recency to be maintained.
    • remove

      private V remove()
      Removes this entry from the cache. This operation is not specified in the paper, which does not account for forced eviction.