Method RemoveBulk
RemoveBulk(IEnumerable<String>, WriteThruOptions)
Removes the specified items from the ICache. You can also specify the write option such that the items may be removed from both cache and data source.
Declaration
void RemoveBulk(IEnumerable<string> keys, WriteThruOptions writeThruOptions = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.String> | keys | List of unique keys to reference the items. |
WriteThruOptions | writeThruOptions | WriteThruOptions regarding updating the data source. This can be either WriteThru, WriteBehind or none. |
Examples
The following example demonstrates how you can remove an item from your application's ICache object.
ICache cache = CacheManager.GetCache("demoClusteredCache");
List<string> keys = new List<string>()
{
"Product0",
"Product1",
"Product2"
};
WriteThruOptions writeThruOptions = new WriteThruOptions(WriteMode.WriteThru, "ProdDataSource1");
cache.RemoveBulk(keys, writeThruOptions);
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException | Keys contain a null reference. |
System.ArgumentException | Keys are not serializable. |
RemoveBulk<T>(IEnumerable<String>, out IDictionary<String, T>, WriteThruOptions)
Removes the specified items from the Alachisoft.NCache.Client.Cache and returns them to the application in the form of a dictionary as an out Parameter.
Declaration
void RemoveBulk<T>(IEnumerable<string> keys, out IDictionary<string, T> removedItems, WriteThruOptions writeThruOptions = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<System.String> | keys | List of unique keys to reference the items. |
System.Collections.Generic.IDictionary<System.String, T> | removedItems | out Parameter through which the removed items from the cache are returned. |
WriteThruOptions | writeThruOptions | WriteThruOptions regarding updating the data source. This can be either WriteThru, WriteBehind or none. |
Type Parameters
Name | Description |
---|---|
T | Specifies the type of value obtained from the cache. |
Remarks
RemovedItems dictionary contains the key and value of the items that were successfully removed from the cache.
Examples
The following example demonstrates how you can remove multiple of items from your application's ICache object.
ICache cache = CacheManager.GetCache("demoClusteredCache");
List<string> keys = new List<string>()
{
"Product0",
"Product1",
"Product2"
};
WriteThruOptions writeThruOptions = new WriteThruOptions(WriteMode.WriteThru, "ProdDataSource1");
IDictionary<string, Product> products = null;
cache.RemoveBulk<Product>(keys,out products);
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException |
|