Class LRUCache<K,V>

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
org.trustdeck.utils.LRUCache<K,V>
Type Parameters:
K - the key
V - the value
All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>, SequencedMap<K,V>

public final class LRUCache<K,V> extends LinkedHashMap<K,V>
Basic least recently used (LRU) cache. Eviction based on the access order settings of the superclass. Not thread-safe.
Author:
Armin Müller
See Also:
  • Constructor Details

    • LRUCache

      public LRUCache(int maxSize)
      Basic constructor for the cache.
      Parameters:
      maxSize - the maximum size for the cache; further entries lead to eviction of the least recently used one
  • Method Details