Removes the object from the Cache.

Namespace: Alachisoft.NCache.Web.Caching
Assembly: Alachisoft.NCache.Web (in Alachisoft.NCache.Web.dll) Version: 4.1.0.0 (4.1.0.0)

Syntax

C#
public virtual void Delete(
	string key,
	DSWriteOption dsWriteOption,
	DataSourceItemsRemovedCallback onDataSourceItemRemovedCallback
)
Visual Basic
Public Overridable Sub Delete ( _
	key As String, _
	dsWriteOption As DSWriteOption, _
	onDataSourceItemRemovedCallback As DataSourceItemsRemovedCallback _
)
Visual C++
public:
virtual void Delete(
	String^ key, 
	DSWriteOption dsWriteOption, 
	DataSourceItemsRemovedCallback^ onDataSourceItemRemovedCallback
)

Parameters

key
Type: System..::..String
The cache key used to reference the item.
dsWriteOption
Type: Alachisoft.NCache.Web.Caching..::..DSWriteOption
Options regarding updating the data source.
onDataSourceItemRemovedCallback
Type: Alachisoft.NCache.Web.Caching..::..DataSourceItemsRemovedCallback
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 incase of failure.

Examples

The following example demonstrates how you can remove an item from your application's Cache object.
CopyC#
Cache cache = NCache.InitializeCache("myCache");
cache.Remove("timestamp", DSWriteOption.None, null, "group-name", "subGroup-name");

Exceptions

ExceptionCondition
System..::..ArgumentNullExceptionkey contains a null reference (Nothing in Visual Basic).
System..::..ArgumentExceptionkey is not serializable.

See Also