Package org.h2.util

Class SmallLRUCache<K,V>

Type Parameters:
K - the key
V - the value
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>, SequencedMap<K,V>

public class SmallLRUCache<K,V> extends LinkedHashMap<K,V>
This class implements a small LRU object cache.
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      See Also:
    • size

      private int size
  • Constructor Details

    • SmallLRUCache

      private SmallLRUCache(int size)
  • Method Details

    • newInstance

      public static <K, V> SmallLRUCache<K,V> newInstance(int size)
      Create a new object with all elements of the given collection.
      Type Parameters:
      K - the key type
      V - the value type
      Parameters:
      size - the number of elements
      Returns:
      the object
    • setMaxSize

      public void setMaxSize(int size)
    • removeEldestEntry

      protected boolean removeEldestEntry(Map.Entry<K,V> eldest)
      Overrides:
      removeEldestEntry in class LinkedHashMap<K,V>