Class ConcurrentCache<T>
- All Implemented Interfaces:
Serializable, ConcurrentMap<Object,T>, Map<Object, T>, Cache<T>
- Direct Known Subclasses:
ScannerBuilder, ScannerBuilder.Entry
The
ConcurrentCache interface is used to represent a
cache that will store key value pairs. This implementation is
backed by a ConcurrentHashMap for best performance.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ConcurrentHashMap
ConcurrentHashMap.KeySetView<K,V> Nested classes/interfaces inherited from class AbstractMap
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K, V> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidThis method is used to insert a key value mapping in to the cache.booleanThis is used to determine whether the specified key exists with in the cache.This method is used to get the value from the cache that is mapped to the specified key.This is used to exclusively take the value mapped to the specified key from the cache.Methods inherited from class ConcurrentHashMap
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, valuesMethods inherited from class AbstractMap
clone
-
Constructor Details
-
ConcurrentCache
public ConcurrentCache()Constructor for theConcurrentCacheobject. This is an implementation of a cache that uses the conventional concurrent hash map from the Java collections API.
-
-
Method Details
-
cache
This method is used to insert a key value mapping in to the cache. The value can later be retrieved or removed from the cache if desired. If the value associated with the key is null then nothing is stored within the cache. -
take
This is used to exclusively take the value mapped to the specified key from the cache. Invoking this is effectively removing the value from the cache. -
fetch
This method is used to get the value from the cache that is mapped to the specified key. If there is no value mapped to the specified key then this method will return a null. -
contains
This is used to determine whether the specified key exists with in the cache. Typically this can be done using the fetch method, which will acquire the object.
-