U
- type parameter indicating the type of the cache keysV
- type parameter indicating the type of the data that is cachedpublic class DefaultCacheMap<U,V> extends java.lang.Object implements CacheMap<U,V>
CacheMap
that is based on a regular LinkedHashMap
.Constructor and Description |
---|
DefaultCacheMap()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
CacheMap<U,V> |
clear()
Clears all entries of the cache map
|
boolean |
containsKey(U key)
Checks whether the specified key is contained in the cach map.
|
CacheMap<U,V> |
delete(U key)
Deletes the entry with the specified key from the cache map, if it exists.
|
V |
get(U key)
Gets the specified key from the cache map.
|
CacheMap<U,V> |
set(U key,
V value)
Creates a new cache map entry with the specified key and value, or updates the value if the key already exists.
|
public boolean containsKey(U key)
containsKey
in interface CacheMap<U,V>
key
- the key to checktrue
if the cache contains the key, false
otherwisepublic V get(U key)
May throw an exception if the key does not exists, depending on the cache map implementation that is used,
so be sure to check CacheMap.containsKey(Object)
first.
public CacheMap<U,V> set(U key, V value)
public CacheMap<U,V> delete(U key)