public class LeastRecentlyUsedCache<K,V>
extends java.util.LinkedHashMap<K,V>
LinkedHashMap
. This cache can hold a fixed maximum number of
elements; if a new element is added, and the cache is full, the least recently used entry is removed.Modifier and Type | Field and Description |
---|---|
private int |
cacheSize |
private static long |
serialVersionUID |
Constructor and Description |
---|
LeastRecentlyUsedCache(int size)
Creates a new least-recently-used cache.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
removeEldestEntry(java.util.Map.Entry<K,V> eldest) |
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
private static final long serialVersionUID
private int cacheSize