java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
net.i2p.util.LHMCache<K,V>
- Type Parameters:
K- type of keys in this cacheV- type of values in this cache
- All Implemented Interfaces:
Serializable, Cloneable, Map<K,V>, SequencedMap<K, V>
A LinkedHashMap with a maximum size, for use as an LRU cache. Unsynchronized.
- See Also:
Nested Class Summary
Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> Constructor Summary
ConstructorsMethod Summary
All MethodsMethods inherited from class LinkedHashMap
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, newLinkedHashMap, putFirst, putLast, replaceAll, reversed, sequencedEntrySet, sequencedKeySet, sequencedValues, valuesMethods inherited from class HashMap
compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, newHashMap, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class AbstractMap
equals, hashCode, toStringMethods inherited from interface SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry
Constructor Details
LHMCache
public LHMCache(int max) Bounded cache with LRU eviction.- Parameters:
max- maximum entries before oldest are evicted
Method Details
clone
removeEldestEntry
Evict eldest when over capacity.- Overrides:
removeEldestEntryin classLinkedHashMap<K,V>