public class LRUCache<K,V> extends LinkedHashMap<K,V>
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
protected int |
capacity |
| Constructor and Description |
|---|
LRUCache(int cap)
LinkedHashMap(16, 0.75F, true).
|
LRUCache(int cap,
boolean accessOrder)
LinkedHashMap(16, 0.75F, accessOrder).
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
removeEldestEntry(Map.Entry<K,V> eldest) |
void |
setCapacity(int cap)
Set capacity of cache.
|
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, valuesclone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizeequals, hashCode, toStringfinalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, containsKey, equals, hashCode, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, sizepublic LRUCache(int cap,
boolean accessOrder)
cap - capacity of this cache. (0 means infinite capacity)accessOrder - cache behavior LRU / FIFO. true... LRU, false... FIFO.public LRUCache(int cap)
cap - capacity of this cache. (0 means infinite capacity)public void setCapacity(int cap)
cap - new capacity of this cache. (0 means infinite capacity)protected boolean removeEldestEntry(Map.Entry<K,V> eldest)
removeEldestEntry in class LinkedHashMap<K,V>EDB Working Group at Mon Dec 15 16:45:05 JST 2025