public class PlatformDotNetCacheStore<K,V> extends Object implements CacheStore<K,V>, PlatformCacheStore, LifecycleAware
This wrapper should be used if you have an implementation of
GridGain.Cache.IGridCacheStore interface in .NET and
would like to configure it a persistence storage for your cache.
If properly configured, this wrapper will instantiate an instance
of your cache store in .NET and delegate all calls to that instance.
To create an instance, assembly name and class name are passed to
System.Activator.CreateInstance(String, String)
method in .NET during node startup. Refer to its documentation for
details.
| Modifier and Type | Field and Description |
|---|---|
protected PlatformContext |
platformCtx
Interop processor.
|
protected long |
ptr
Pointer to native store.
|
| Constructor and Description |
|---|
PlatformDotNetCacheStore()
Default ctor.
|
PlatformDotNetCacheStore(Object nativeFactory)
Native factory ctor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
delete(Object key) |
void |
deleteAll(Collection<?> keys) |
protected int |
doInvoke(IgniteInClosure<BinaryRawWriterEx> task,
IgniteInClosure<BinaryRawReaderEx> readClo)
Perform actual invoke.
|
Map<String,?> |
getProperties()
Get properties.
|
String |
getTypeName()
Gets .NET class name.
|
void |
initialize(GridKernalContext ctx,
boolean convertBinary)
Initialize the store.
|
V |
load(K key) |
Map<K,V> |
loadAll(Iterable<? extends K> keys) |
void |
loadCache(IgniteBiInClosure<K,V> clo,
Object... args)
Loads all values from underlying persistent storage.
|
void |
sessionEnd(boolean commit)
Tells store to commit or rollback a transaction depending on the value of the
'commit'
parameter. |
void |
setProperties(Map<String,?> props)
Set properties.
|
void |
setTypeName(String typName)
Sets .NET class name.
|
void |
start()
Starts grid component, called on grid start.
|
void |
stop()
Stops grid component, called on grid shutdown.
|
String |
toString() |
protected void |
write(BinaryRawWriterEx writer,
boolean convertBinary)
Write store data to a stream.
|
void |
write(javax.cache.Cache.Entry<? extends K,? extends V> entry) |
void |
writeAll(Collection<javax.cache.Cache.Entry<? extends K,? extends V>> entries) |
@GridToStringExclude protected PlatformContext platformCtx
@GridToStringExclude protected long ptr
public PlatformDotNetCacheStore()
public PlatformDotNetCacheStore(Object nativeFactory)
public String getTypeName()
public void setTypeName(String typName)
typName - .NET class name.public void setProperties(Map<String,?> props)
props - Properties.public void loadCache(IgniteBiInClosure<K,V> clo, @Nullable Object... args)
IgniteCache.loadCache(IgniteBiPredicate, Object...)
method is invoked which is usually to preload the cache from persistent storage.
This method is optional, and cache implementation does not depend on this
method to do anything. Default implementation of this method in
CacheStoreAdapter does nothing.
For every loaded value method IgniteBiInClosure.apply(Object, Object)
should be called on the passed in closure. The closure will then make sure
that the loaded value is stored in cache.
loadCache in interface CacheStore<K,V>clo - Closure for loaded values.args - Arguments passes into
IgniteCache.loadCache(IgniteBiPredicate, Object...) method.public void writeAll(Collection<javax.cache.Cache.Entry<? extends K,? extends V>> entries)
public void delete(Object key)
public void deleteAll(Collection<?> keys)
public void sessionEnd(boolean commit)
'commit'
parameter.sessionEnd in interface CacheStore<K,V>commit - True if transaction should commit, false for rollback.public void start()
throws IgniteException
start in interface LifecycleAwareIgniteException - If failed.public void stop()
throws IgniteException
stop in interface LifecycleAwareIgniteException - If failed.public void initialize(GridKernalContext ctx, boolean convertBinary) throws IgniteCheckedException
ctx - Context.convertBinary - Convert binary flag.IgniteCheckedExceptionprotected void write(BinaryRawWriterEx writer, boolean convertBinary)
writer - Writer.convertBinary - Convert binary flag.protected int doInvoke(IgniteInClosure<BinaryRawWriterEx> task, IgniteInClosure<BinaryRawReaderEx> readClo) throws IgniteCheckedException
task - Task.readClo - Reader.IgniteCheckedException - If failed.
Follow @ApacheIgnite
Ignite Fabric : ver. 2.5.0 Release Date : May 23 2018