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 value cache.
|
java.util.concurrent.CompletableFuture<java.lang.Void> |
delete(K key)
Deletes the entry with the specified key from the value cache, if it exists.
|
java.util.concurrent.CompletableFuture<V> |
get(K key)
Gets the specified key from the value cache.
|
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, getValues, setValues
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)
NOTE: Your implementation MUST not throw exceptions, rather it should return a CompletableFuture that has completed exceptionally. Failure
to do this may cause the DataLoader
code to not run properly.
delete
in interface ValueCache<K,V>
key
- the key to deletepublic java.util.concurrent.CompletableFuture<java.lang.Void> clear()
NOTE: Your implementation MUST not throw exceptions, rather it should return a CompletableFuture that has completed exceptionally. Failure
to do this may cause the DataLoader
code to not run properly.
clear
in interface ValueCache<K,V>