K
- the type of cache keysV
- the type of cache valuespublic class NoOpValueCache<K,V> extends java.lang.Object implements ValueCache<K,V>
ValueCache
that does nothing.
We don't want to store values in memory twice, so when using the default store we just say we never have the key and complete the other methods by doing nothing.
Modifier and Type | Field and Description |
---|---|
static NoOpValueCache<?,?> |
NOOP |
Constructor and Description |
---|
NoOpValueCache() |
Modifier and Type | Method and Description |
---|---|
java.util.concurrent.CompletableFuture<java.lang.Void> |
clear()
Clears all entries from the store.
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
delete(K key)
Deletes the entry with the specified key from the store, if it exists.
|
java.util.concurrent.CompletableFuture<V> |
get(K key)
Gets the specified key from the store.
|
java.util.concurrent.CompletableFuture<V> |
set(K key,
V value)
Stores the value with the specified key, or updates it if the key already exists.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
defaultValueCache
public static NoOpValueCache<?,?> NOOP
public java.util.concurrent.CompletableFuture<V> get(K key)
DataLoader
to load the key via batch loading
instead.get
in interface ValueCache<K,V>
key
- the key to retrievepublic java.util.concurrent.CompletableFuture<V> set(K key, V value)
set
in interface ValueCache<K,V>
key
- the key to storevalue
- the value to storepublic java.util.concurrent.CompletableFuture<java.lang.Void> delete(K key)
delete
in interface ValueCache<K,V>
key
- the key to deletepublic java.util.concurrent.CompletableFuture<java.lang.Void> clear()
clear
in interface ValueCache<K,V>