K - the key type.
V - the value type.
public class MemoryCachePlus<K,V> extends Object
| Constructor and Description |
|---|
MemoryCachePlus(int size)
Create a memory cache.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Clear this cache.
|
V |
get(K key)
Get the stored element.
|
int |
getSize()
|
K |
put(K key, V value)
Put key, value into the cache.
|
void |
refresh(K key)
Reorder the key within the replacement list.
|
V |
remove(K key)
Remove and get the stored element if any.
|
void |
setSize(int size)
|
public MemoryCachePlus(int size)
size - the number of elements to store.
public int getSize()
public void setSize(int size)
public K put(K key, V value)
key - the key.
value - the value.
public V get(K key)
key - the key to retrieve a value for.
public V remove(K key)
key - the key to remove the value for.
public void refresh(K key)
key - the key to reorder.
public void clear()