Package org.apache.ignite.cache.store
Class CacheStoreAdapter<K,V>
- java.lang.Object
-
- org.apache.ignite.cache.store.CacheStoreAdapter<K,V>
-
- All Implemented Interfaces:
javax.cache.integration.CacheLoader<K,V>
,javax.cache.integration.CacheWriter<K,V>
,CacheStore<K,V>
- Direct Known Subclasses:
CacheJdbcBlobStore
public abstract class CacheStoreAdapter<K,V> extends Object implements CacheStore<K,V>
Cache storage convenience adapter. It provides default implementation for bulk operations, such asloadAll(Iterable)
,writeAll(Collection)
, anddeleteAll(Collection)
by sequentially calling correspondingCacheLoader.load(Object)
,CacheWriter.write(Cache.Entry)
, andCacheWriter.delete(Object)
operations. Use this adapter whenever such behaviour is acceptable. However in many cases it maybe more preferable to take advantage of database batch update functionality, and therefore default adapter implementation may not be the best option.Note that method
loadCache(IgniteBiInClosure, Object...)
has empty implementation because it is essentially up to the user to invoke it with specific arguments.
-
-
Constructor Summary
Constructors Constructor Description CacheStoreAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
deleteAll(Collection<?> keys)
Map<K,V>
loadAll(Iterable<? extends K> keys)
void
loadCache(IgniteBiInClosure<K,V> clo, Object... args)
Default empty implementation.void
sessionEnd(boolean commit)
Default empty implementation for ending transactions.String
toString()
void
writeAll(Collection<javax.cache.Cache.Entry<? extends K,? extends V>> entries)
-
-
-
Method Detail
-
loadCache
public void loadCache(IgniteBiInClosure<K,V> clo, Object... args)
Default empty implementation. This method needs to be overridden only ifIgniteCache.loadCache(IgniteBiPredicate, Object...)
method is explicitly called.- Specified by:
loadCache
in interfaceCacheStore<K,V>
- Parameters:
clo
- Closure for loaded values.args
- Arguments passes intoIgniteCache.loadCache(IgniteBiPredicate, Object...)
method.
-
writeAll
public void writeAll(Collection<javax.cache.Cache.Entry<? extends K,? extends V>> entries)
-
deleteAll
public void deleteAll(Collection<?> keys)
-
sessionEnd
public void sessionEnd(boolean commit)
Default empty implementation for ending transactions. Note that if explicit cache transactions are not used, then transactions do not have to be explicitly ended - for all other cases this method should be overridden with custom commit/rollback logic.- Specified by:
sessionEnd
in interfaceCacheStore<K,V>
- Parameters:
commit
-True
if transaction should commit,false
for rollback.
-
-