Package io.goobi.viewer.controller.model
Class CachingMap<K,V>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<K,V>
java.util.LinkedHashMap<K,V>
io.goobi.viewer.controller.model.CachingMap<K,V>
- Type Parameters:
K- the type of keys maintained by this mapV- the type of mapped values
- All Implemented Interfaces:
Serializable,Cloneable,Map<K,,V> SequencedMap<K,V>
A thread-safe, size-bounded
LinkedHashMap that evicts the eldest entry
when the map exceeds its configured maximum capacity. Suitable as a simple in-memory LRU
cache for moderate data volumes.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.LinkedHashMap
clear, containsValue, entrySet, forEach, keySet, newLinkedHashMap, putFirst, putLast, replaceAll, reversed, sequencedEntrySet, sequencedKeySet, sequencedValues, valuesMethods inherited from class java.util.HashMap
clone, compute, computeIfPresent, containsKey, isEmpty, merge, newHashMap, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from class java.util.AbstractMap
equals, hashCode, toStringMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.Map
compute, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, putAll, putIfAbsent, remove, remove, replace, replace, sizeMethods inherited from interface java.util.SequencedMap
firstEntry, lastEntry, pollFirstEntry, pollLastEntry
-
Constructor Details
-
CachingMap
public CachingMap(long maxSize)
-
-
Method Details
-
get
-
getOrDefault
- Specified by:
getOrDefaultin interfaceMap<K,V> - Overrides:
getOrDefaultin classLinkedHashMap<K,V>
-
put
-
computeIfAbsent
- Specified by:
computeIfAbsentin interfaceMap<K,V> - Overrides:
computeIfAbsentin classHashMap<K,V>
-
removeEldestEntry
- Overrides:
removeEldestEntryin classLinkedHashMap<K,V>
-