Package org.infinispan.persistence.spi
Interface CacheWriter<K,V>
-
- All Superinterfaces:
org.infinispan.commons.api.Lifecycle
- All Known Subinterfaces:
AdvancedCacheExpirationWriter<K,V>
,AdvancedCacheWriter<K,V>
,AdvancedLoadWriteStore<K,V>
,ExternalStore<K,V>
,FlagAffectedStore<K,V>
,SegmentedAdvancedLoadWriteStore<K,V>
,TransactionalCacheWriter<K,V>
- All Known Implementing Classes:
AbstractSegmentedAdvancedLoadWriteStore
,AdvancedAsyncCacheWriter
,AdvancedSingletonCacheWriter
,AsyncCacheWriter
,ComposedSegmentedLoadWriteStore
,DelegatingCacheWriter
,JdbcStringBasedStore
,JpaStore
,RemoteStore
,RestStore
,RocksDBStore
,SingleFileStore
,SingletonCacheWriter
,SoftIndexFileStore
@ThreadSafe public interface CacheWriter<K,V> extends org.infinispan.commons.api.Lifecycle
Allows persisting data to an external storage, as opposed to theCacheLoader
.- Since:
- 6.0
- Author:
- Mircea Markus
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description boolean
delete(Object key)
default void
deleteBatch(Iterable<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()
void
write(MarshalledEntry<? extends K,? extends V> entry)
Persists the entry to the storage.default void
writeBatch(Iterable<MarshalledEntry<? extends K,? extends V>> entries)
Persist all provided entries to the store in a single batch update.
-
-
-
Method Detail
-
init
void init(InitializationContext ctx)
Used to initialize a cache loader. Typically invoked by thePersistenceManager
when setting up cache loaders.- Throws:
PersistenceException
- in case of an error, e.g. communicating with the external storage
-
write
void write(MarshalledEntry<? extends K,? extends V> entry)
Persists the entry to the storage.- Throws:
PersistenceException
- in case of an error, e.g. communicating with the external storage- See Also:
MarshalledEntry
-
delete
boolean delete(Object key)
- Returns:
- true if the entry existed in the persistent store and it was deleted.
- Throws:
PersistenceException
- in case of an error, e.g. communicating with the external storage
-
writeBatch
default void writeBatch(Iterable<MarshalledEntry<? extends K,? extends V>> entries)
Persist all provided entries to the store in a single batch update. If this is not supported by the underlying store, then entries are written to the store individually viawrite(MarshalledEntry)
.- Parameters:
entries
- an Iterable of MarshalledEntry to be written to the store.- Throws:
NullPointerException
- if entries is null.
-
deleteBatch
default void deleteBatch(Iterable<Object> keys)
Remove all provided keys from the store in a single batch operation. If this is not supported by the underlying store, then keys are removed from the store individually viadelete(Object)
.- Parameters:
keys
- an Iterable of entry Keys to be removed from the store.- Throws:
NullPointerException
- if keys is null.
-
isAvailable
default boolean isAvailable()
- Returns:
- true if the writer can be connected to, otherwise false
-
-