K
- the most general type of keys this writer can write; for example Object
if any
key is acceptableV
- the most general type of values this write can write; for example Object
if
any value is acceptablepublic interface CacheWriter<K,V>
reason
. The writer is not notified when an entry is loaded or computed.Modifier and Type | Method and Description |
---|---|
void |
delete(K key,
V value,
@NonNull RemovalCause cause)
Deletes the value corresponding to the
key from the external resource. |
static <K,V> @NonNull CacheWriter<K,V> |
disabledWriter()
Returns a writer that does nothing.
|
void |
write(K key,
V value)
Writes the value corresponding to the
key to the external resource. |
void write(K key, V value)
key
to the external resource. The cache will
communicate a write when an entry in the cache is created or modified, except when that was
due to a load or computation.key
- the non-null key whose value should be writtenvalue
- the value associated with key
that should be writtenRuntimeException
- or Error, in which case the mapping is unchangedvoid delete(K key, V value, @NonNull RemovalCause cause)
key
from the external resource. The cache will
communicate a delete when the entry is explicitly removed or evicted.key
- the non-null key whose value was removedvalue
- the value associated with key
, or null
if collectedcause
- the reason for which the entry was removedRuntimeException
- or Error, in which case the mapping is unchangedstatic <K,V> @NonNull CacheWriter<K,V> disabledWriter()
K
- the type of keysV
- the type of values