K - the key type.
V - the value type.
public class MemoryCache<K,V> extends Object
| Constructor and Description |
|---|
MemoryCache(int size)
Create a memory cache.
|
public MemoryCache(int size)
size - the number of elements to store.
public int getSize()
public void setSize(int size)
public void 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 clear()