K
- the type of the cache keysV
- the type of the cache valuespublic class LRUCache<K,V> extends java.lang.Object implements Cache<K,V>
Constructor and Description |
---|
LRUCache(int cacheCapacity)
Create a new LRUCache with the specified capacity.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Delete all entries from the cache.
|
void |
delete(K key)
Delete a key-value pair from the cache.
|
void |
deleteAll(java.util.List<K> keys)
Delete one or more key-value pairs from the cache.
|
V |
get(K key)
Look up a value in the cache.
|
java.util.Map<K,V> |
getAll(java.util.List<K> keys)
Look up one or more values in the cache.
|
Stats<java.lang.Void> |
getStatistics()
This cache implementation does not provide any statistics.
|
void |
put(K key,
V value)
Cache a key-value pair.
|
void |
putAll(java.util.Map<K,V> map)
Cache one or more key-value pairs.
|
long |
size() |
public LRUCache(int cacheCapacity)
cacheCapacity
- maximum number of entries to storepublic void clear()
public void delete(K key)
public void deleteAll(java.util.List<K> keys)
public java.util.Map<K,V> getAll(java.util.List<K> keys)
public Stats<java.lang.Void> getStatistics()
Stats.getStats()
will return null
.getStatistics
in interface Cache<K,V>
null
for calls to getStats()