@ThreadSafe public interface CacheWriter<K,V> extends Lifecycle
CacheLoader.| Modifier and Type | Method and Description |
|---|---|
default java.util.concurrent.CompletionStage<java.lang.Void> |
bulkUpdate(org.reactivestreams.Publisher<MarshallableEntry<? extends K,? extends V>> publisher)
Persist all provided entries to the store in chunks, with the size of each chunk determined by the store
implementation.
|
boolean |
delete(java.lang.Object key) |
default void |
deleteBatch(java.lang.Iterable<java.lang.Object> keys)
Remove all provided keys from the store in a single batch operation.
|
void |
init(InitializationContext ctx)
Used to initialize a cache loader.
|
default boolean |
isAvailable() |
default void |
write(MarshallableEntry<? extends K,? extends V> entry)
Persists the entry to the storage.
|
default void |
write(MarshalledEntry<? extends K,? extends V> entry)
Deprecated.
since 10.0, use
write(MarshallableEntry) instead. |
default void |
writeBatch(java.lang.Iterable<MarshalledEntry<? extends K,? extends V>> entries)
Deprecated.
since 10.0, use
bulkUpdate(Publisher) instead. |
void init(InitializationContext ctx)
PersistenceManager
when setting up cache loaders.PersistenceException - in case of an error, e.g. communicating with the external storagedefault void write(MarshallableEntry<? extends K,? extends V> entry)
PersistenceException - in case of an error, e.g. communicating with the external storageMarshallableEntry@Deprecated default void write(MarshalledEntry<? extends K,? extends V> entry)
write(MarshallableEntry) instead.boolean delete(java.lang.Object key)
PersistenceException - in case of an error, e.g. communicating with the external storage@Deprecated default void writeBatch(java.lang.Iterable<MarshalledEntry<? extends K,? extends V>> entries)
bulkUpdate(Publisher) instead.write(MarshallableEntry).entries - an Iterable of MarshalledEntry to be written to the store.java.lang.NullPointerException - if entries is null.default java.util.concurrent.CompletionStage<java.lang.Void> bulkUpdate(org.reactivestreams.Publisher<MarshallableEntry<? extends K,? extends V>> publisher)
write(MarshallableEntry).publisher - a Publisher of MarshallableEntry instancesjava.lang.NullPointerException - if the publisher is null.default void deleteBatch(java.lang.Iterable<java.lang.Object> keys)
delete(Object).keys - an Iterable of entry Keys to be removed from the store.java.lang.NullPointerException - if keys is null.default boolean isAvailable()