public class ConcurrentCache<T> extends java.util.concurrent.ConcurrentHashMap<java.lang.Object,T> implements Cache<T>
ConcurrentCache
interface is used to represent a
cache that will store key value pairs. This implementation is
backed by a ConcurrentHashMap
for best performance.Constructor and Description |
---|
ConcurrentCache()
Constructor for the
ConcurrentCache object. |
Modifier and Type | Method and Description |
---|---|
void |
cache(java.lang.Object key,
T value)
This method is used to insert a key value mapping in to the
cache.
|
boolean |
contains(java.lang.Object key)
This is used to determine whether the specified key exists
with in the cache.
|
T |
fetch(java.lang.Object key)
This method is used to get the value from the cache that is
mapped to the specified key.
|
T |
take(java.lang.Object key)
This is used to exclusively take the value mapped to the
specified key from the cache.
|
clear, containsKey, containsValue, elements, entrySet, get, isEmpty, keys, keySet, put, putAll, putIfAbsent, remove, remove, replace, replace, size, values
public ConcurrentCache()
ConcurrentCache
object. This
is an implementation of a cache that uses the conventional
concurrent hash map from the Java collections API.public void cache(java.lang.Object key, T value)
public T take(java.lang.Object key)
public T fetch(java.lang.Object key)
public boolean contains(java.lang.Object key)