T
- The cache key type.V
- The cache value type.public class LeastRecentlyUsed<T,V> extends LinkedHashMap<T,V>
Specially maintains a cache up to the size limit specified. After which point will start to discard entries in Least Recently Used order.
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
Constructor and Description |
---|
LeastRecentlyUsed(int maxSize)
Constructs a new LeastRecentlyUsed cache.
|
Modifier and Type | Method and Description |
---|---|
int |
getMaxSize()
Get the maximum size of the cache.
|
protected boolean |
removeEldestEntry(Map.Entry<T,V> entry) |
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
equals, hashCode, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
compute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
public LeastRecentlyUsed(int maxSize)
maxSize
- The maximum size of the cache.protected boolean removeEldestEntry(Map.Entry<T,V> entry)
removeEldestEntry
in class LinkedHashMap<T,V>
public int getMaxSize()
Copyright © 2010–2025 Open Identity Platform Community. All rights reserved.