public class LRUCache<K,V> extends Object implements CacheImplementationInterface<K,V>
LinkedHashMap, in access-order mode, and
restricted maximal size ('Least Recently Used' cache algorithm).Cache| Modifier and Type | Field and Description |
|---|---|
int |
maxSize |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
void |
config(Map<String,String> map)
Configure the implementation with the given configuration values
|
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set<Map.Entry<K,V>> |
entrySet() |
V |
get(Object key) |
int |
getCount(K key)
Returns the hit-count on a certain key (if implementable, -1 otherwise).
|
Object |
getLock()
The cache implementation must be somehow thread-safe.
|
boolean |
isEmpty() |
Set<K> |
keySet() |
int |
maxSize()
Gets the (maximal) size of the cache (if implementable)
|
V |
put(K key,
V value) |
void |
putAll(Map<? extends K,? extends V> map) |
V |
remove(Object key) |
void |
setMaxSize(int size)
Change the maximum size of the table.
|
int |
size() |
String |
toString()
Returns size, maxSize.
|
Collection<V> |
values() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, equals, forEach, getOrDefault, hashCode, merge, putIfAbsent, remove, replace, replace, replaceAllpublic int getCount(K key)
CacheImplementationInterfacegetCount in interface CacheImplementationInterface<K,V>public void setMaxSize(int size)
setMaxSize in interface CacheImplementationInterface<K,V>size - the new desired sizepublic final int maxSize()
CacheImplementationInterfacemaxSize in interface CacheImplementationInterface<K,V>public void config(Map<String,String> map)
CacheImplementationInterfaceconfig in interface CacheImplementationInterface<K,V>public Object getLock()
CacheImplementationInterfacegetLock in interface CacheImplementationInterface<K,V>public boolean containsKey(Object key)
containsKey in interface Map<K,V>public boolean containsValue(Object value)
containsValue in interface Map<K,V>MMBase 1.9-SNAPSHOT - ${javadoctimestamp}