Method Invoke
Invoke(IEnumerable<String>, IEntryProcessor, ReadThruOptions, WriteThruOptions, Object[])
Execution of entry processor on a set of keys regardless of caching topology used, allows to execute code against a set of cache entries on server side without fetching any data on client side.
Declaration
ICollection Invoke(IEnumerable<string> keys, IEntryProcessor entryProcessor, ReadThruOptions readThruOption = null, WriteThruOptions writeThruOption = null, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.String> | keys | Set of keys of Cache entries on which EntryProcessor will be executed. |
Alachisoft.NCache.Runtime.Processor.IEntryProcessor | entryProcessor | IEntryProcessor instance. |
ReadThruOptions | readThruOption | ReadThruOptions to read from data source. These can be either ReadThru, ReadThruForced or None. |
WriteThruOptions | writeThruOption | WriteThruOptions regarding updating the data source. This can be either WriteThru, WriteBehind or None. |
System.Object[] | arguments | Arguments list for the process. |
Returns
Type | Description |
---|---|
System.Collections.ICollection | Returns a collection of instances of IEntryProcessorResult. |
Examples
ICache cache = CacheManager.GetCache("demoClusteredCache");
//Get a new instance of sample Class implementing EntryProcessor interface.
CustomEntryProcessor myProcessor = new CustomEntryProcessor();
string[] keys = new string[] { "1", "5", "12", "15" };
cache.Insert(keys[0], "Value1");
cache.Insert(keys[1], "Value1");
cache.Insert(keys[2], "Value1");
cache.Insert(keys[3], "Value1");
//Invoking the Entry processor against a set of items.
ReadThruOptions readThruOptions = new ReadThruOptions(ReadMode.ReadThru, "ProdDataSource");
WriteThruOptions writeThruOptions = new WriteThruOptions(WriteMode.WriteThru, "ProdDataSource");
ICollection retEntries = cache.ExecutionService.Invoke(keys, myProcessor,readThruOptions,writeThruOptions);
Invoke(String, IEntryProcessor, ReadThruOptions, WriteThruOptions, Object[])
Execution of entry processor regardless of caching topology used, allows to execute code against a cache entry on server side without fetching any data on client side.
Declaration
object Invoke(string key, IEntryProcessor entryProcessor, ReadThruOptions readThruOption = null, WriteThruOptions writeThruOption = null, params object[] arguments)
Parameters
Type | Name | Description |
---|---|---|
System.String | key | Key of Cache entry on which the EntryProcessor is executed. |
Alachisoft.NCache.Runtime.Processor.IEntryProcessor | entryProcessor | IEntryProcessor instance |
ReadThruOptions | readThruOption | ReadThruOptions to read from data source. These can be either ReadThru, ReadThruForced or None. |
WriteThruOptions | writeThruOption | WriteThruOptions regarding updating the data source. This can be either WriteThru, WriteBehind or None. |
System.Object[] | arguments | Arguments list for the process. |
Returns
Type | Description |
---|---|
System.Object | Returns an instance of IEntryProcessorResult. |
Examples
ICache cache = CacheManager.GetCache("demoClusteredCache");
//Get a new instance of sample Class implementing EntryProcessor interface.
CustomEntryProcessor myProcessor = new CustomEntryProcessor();
string[] keys = new string[] { "1", "5", "12", "15" };
cache.Insert(keys[0], "Value1");
cache.Insert(keys[1], "Value1");
cache.Insert(keys[2], "Value1");
cache.Insert(keys[3], "Value1");
//Invoking the Entry processor against a set of items.
ReadThruOptions readThruOptions = new ReadThruOptions(ReadMode.ReadThru, "ProdDataSource");
WriteThruOptions writeThruOptions = new WriteThruOptions(WriteMode.WriteThru, "ProdDataSource");
Object invokerVal = cache.ExecutionService.Invoke(keys[2], myProcessor,readThruOptions,writeThruOptions);