java.io.Serializable
, java.util.concurrent.ConcurrentMap<java.lang.Object,T>
, java.util.Map<java.lang.Object,T>
, Cache<T>
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.java.util.AbstractMap.SimpleEntry<K extends java.lang.Object,V extends java.lang.Object>, java.util.AbstractMap.SimpleImmutableEntry<K extends java.lang.Object,V extends java.lang.Object>
Constructor | Description |
---|---|
ConcurrentCache() |
Constructor for the
ConcurrentCache object. |
Modifier and Type | Method | 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, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, elements, entrySet, equals, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, get, getOrDefault, hashCode, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, put, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, 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)