public class LRU<K,V>
extends java.util.LinkedHashMap<K,V>
Modifier and Type | Field and Description |
---|---|
protected ILRUEntryCleaner |
cleaner
The entry cleaner (for performing cleanup code on removed entries).
|
protected int |
max
The maximum number of entries.
|
Constructor and Description |
---|
LRU()
Create a new LRU with 1000 entries.
|
LRU(int max)
Create a new LRU.
|
LRU(int max,
ILRUEntryCleaner cleaner)
Create a new LRU.
|
Modifier and Type | Method and Description |
---|---|
ILRUEntryCleaner |
getCleaner()
Get the cleaner object.
|
int |
getMaxEntries()
Get the maximum number of the
|
boolean |
removeEldestEntry(java.util.Map.Entry<K,V> eldest)
Remove the eldest entry.
|
void |
setCleaner(ILRUEntryCleaner cleaner)
Set the cleaner object.
|
void |
setMaxEntries(int max)
Set the maximum number of entries.
|
clear, containsValue, entrySet, forEach, get, getOrDefault, keySet, replaceAll, values
clone, compute, computeIfAbsent, computeIfPresent, containsKey, isEmpty, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, size
protected int max
protected ILRUEntryCleaner cleaner
public LRU()
public LRU(int max)
max
- The maximum number of entries.public LRU(int max, ILRUEntryCleaner cleaner)
max
- The maximum number of entries.public int getMaxEntries()
public void setMaxEntries(int max)
max
- The maximum number of entries.public ILRUEntryCleaner getCleaner()
public void setCleaner(ILRUEntryCleaner cleaner)
cleaner
- The cleaner object.