K
- type parameter indicating the type of the cache keysV
- type parameter indicating the type of the data that is cachedpublic class DefaultCacheMap<K,V> extends java.lang.Object implements CacheMap<K,V>
CacheMap
that is based on a regular HashMap
.Constructor and Description |
---|
DefaultCacheMap()
Default constructor
|
Modifier and Type | Method and Description |
---|---|
CacheMap<K,V> |
clear()
Clears all entries of the cache map
|
boolean |
containsKey(K key)
Checks whether the specified key is contained in the cache map.
|
CacheMap<K,V> |
delete(K key)
Deletes the entry with the specified key from the cache map, if it exists.
|
java.util.concurrent.CompletableFuture<V> |
get(K key)
Gets the specified key from the cache map.
|
java.util.Collection<java.util.concurrent.CompletableFuture<V>> |
getAll()
Gets a collection of CompletableFutures from the cache map.
|
CacheMap<K,V> |
set(K key,
java.util.concurrent.CompletableFuture<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(K key)
containsKey
in interface CacheMap<K,V>
key
- the key to checktrue
if the cache contains the key, false
otherwisepublic java.util.concurrent.CompletableFuture<V> get(K 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 java.util.Collection<java.util.concurrent.CompletableFuture<V>> getAll()
public CacheMap<K,V> set(K key, java.util.concurrent.CompletableFuture<V> value)
public CacheMap<K,V> delete(K key)