Method RemoveBulk
RemoveBulk(String[], DSWriteOption, DataSourceItemsRemovedCallback)
Removes the objects from the Cache.
Declaration
public virtual IDictionary RemoveBulk(string[] keys, DSWriteOption dsWriteOption, DataSourceItemsRemovedCallback onDataSourceItemsRemovedCallback)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | keys | The cache keys used to reference the item. |
DSWriteOption | dsWriteOption | Options regarding updating data source |
DataSourceItemsRemovedCallback | onDataSourceItemsRemovedCallback | A delegate that, if provided, is called when item is removed from data source. |
Returns
Type | Description |
---|---|
System.Collections.IDictionary | The items removed from the Cache. If the value in the keys parameter is not found, returns a null reference (Nothing in Visual Basic). |
Remarks
Note: If exceptions are enabled through the ExceptionsEnabled setting, this property throws exception in case of failure.
Examples
The following example demonstrates how you can remove an item from your application's Cache object.
OnDataSourceItemsRemoved(IDictionary result)
{
...
}
Cache cache = NCache.InitializeCache("myCache");
string[] keys = new string[]{"myItem1", "myItem2"};
cache.Remove(keys, DSWriteOption.WriteBehind, new DataSourceItemsRemovedCallback(OnDataSourceItemsRemoved), "group-name", "subGroup-name");
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException |
|
RemoveBulk(String[])
Removes the objects from the Cache.
Declaration
public virtual IDictionary RemoveBulk(string[] keys)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | keys | The cache keys used to reference the item. |
Returns
Type | Description |
---|---|
System.Collections.IDictionary | The items removed from the Cache. If the value in the keys parameter is not found, returns a null reference (Nothing in Visual Basic). |
Remarks
Note: If exceptions are enabled through the ExceptionsEnabled setting, this property throws exception in case of failure.
Examples
The following example demonstrates how you can remove an item from your application's Cache object.
OnDataSourceItemsRemoved(IDictionary result)
{
...
}
Cache cache = NCache.InitializeCache("myCache");
string[] keys = new string[]{"myItem1", "myItem2"};
cache.RemoveBulk(keys);
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException |
|
RemoveBulk(String[], DSWriteOption, String, DataSourceItemsRemovedCallback)
Removes the objects from the Cache.
Declaration
public virtual IDictionary RemoveBulk(string[] keys, DSWriteOption dsWriteOption, string providerName, DataSourceItemsRemovedCallback onDataSourceItemsRemovedCallback)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | keys | The cache keys used to reference the item. |
DSWriteOption | dsWriteOption | Options regarding updating data source |
System.String | providerName | |
DataSourceItemsRemovedCallback | onDataSourceItemsRemovedCallback | A delegate that, if provided, is called when A unique identifier for the data source item is removed from data source. |
Returns
Type | Description |
---|---|
System.Collections.IDictionary | The items removed from the Cache. If the value in the keys parameter is not found, returns a null reference (Nothing in Visual Basic). |
Remarks
Note: If exceptions are enabled through the ExceptionsEnabled setting, this property throws exception in case of failure.
Examples
The following example demonstrates how you can remove an item from your application's Cache object.
OnDataSourceItemsRemoved(IDictionary result)
{
...
}
Cache cache = NCache.InitializeCache("myCache");
string[] keys = new string[]{"myItem1", "myItem2"};
cache.Remove(keys, DSWriteOption.WriteBehind, new DataSourceItemsRemovedCallback(OnDataSourceItemsRemoved), "group-name", "subGroup-name");
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException |
|