Package org.dataloader.impl
Class DefaultCacheMap<K,V>
- java.lang.Object
-
- org.dataloader.impl.DefaultCacheMap<K,V>
-
- Type Parameters:
K
- type parameter indicating the type of the cache keysV
- type parameter indicating the type of the data that is cached
- All Implemented Interfaces:
CacheMap<K,V>
public class DefaultCacheMap<K,V> extends java.lang.Object implements CacheMap<K,V>
Default implementation ofCacheMap
that is based on a regularHashMap
.
-
-
Constructor Summary
Constructors Constructor Description DefaultCacheMap()
Default constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CacheMap<K,V>
clear()
Clears all entries of the cache mapboolean
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.
-
-
-
Method Detail
-
containsKey
public boolean containsKey(K key)
Checks whether the specified key is contained in the cache map.- Specified by:
containsKey
in interfaceCacheMap<K,V>
- Parameters:
key
- the key to check- Returns:
true
if the cache contains the key,false
otherwise
-
get
public java.util.concurrent.CompletableFuture<V> get(K key)
Gets the specified key from the cache map.May throw an exception if the key does not exist, depending on the cache map implementation that is used.
-
getAll
public java.util.Collection<java.util.concurrent.CompletableFuture<V>> getAll()
Gets a collection of CompletableFutures from the cache map.
-
set
public 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.
-
delete
public CacheMap<K,V> delete(K key)
Deletes the entry with the specified key from the cache map, if it exists.
-
-