Method DeleteBulk
DeleteBulk(String[], DSWriteOption, DataSourceItemsRemovedCallback)
Removes bulk objects from the Cache.
Declaration
public virtual void DeleteBulk(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. |
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 |
|
DeleteBulk(String[])
Removes the objects from the Cache.
Declaration
public virtual void DeleteBulk(string[] keys)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | keys | The cache keys used to reference the item. |
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);
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
System.ArgumentException |
|
DeleteBulk(String[], DSWriteOption, String, DataSourceItemsRemovedCallback)
Removes the objects from the Cache.
Declaration
public virtual void DeleteBulk(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. |
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 |
|