Removes the object from the Cache asynchronously.

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

Syntax

C#
public override void RemoveAsync(
	string key,
	AsyncItemRemovedCallback onAsyncItemRemoveCallback,
	DSWriteOption dsWriteOption,
	string providerName,
	DataSourceItemsRemovedCallback onDataSourceItemRemovedCallback
)
Visual Basic
Public Overrides Sub RemoveAsync ( 
	key As String,
	onAsyncItemRemoveCallback As AsyncItemRemovedCallback,
	dsWriteOption As DSWriteOption,
	providerName As String,
	onDataSourceItemRemovedCallback As DataSourceItemsRemovedCallback
)
Visual C++
public:
virtual void RemoveAsync(
	String^ key, 
	AsyncItemRemovedCallback^ onAsyncItemRemoveCallback, 
	DSWriteOption dsWriteOption, 
	String^ providerName, 
	DataSourceItemsRemovedCallback^ onDataSourceItemRemovedCallback
) override

Parameters

key
Type: System..::..String
The cache key used to reference the item.
onAsyncItemRemoveCallback
Type: Alachisoft.NCache.Web.Caching..::..AsyncItemRemovedCallback
The delegate that can be used by the client application to get the result of the Asynchronous Remove operation.
dsWriteOption
Type: Alachisoft.NCache.Web.Caching..::..DSWriteOption
Options regarding updating data source
providerName
Type: System..::..String
onDataSourceItemRemovedCallback
Type: Alachisoft.NCache.Web.Caching..::..DataSourceItemsRemovedCallback

Return Value

Type:
The item removed from the Cache. If the value in the key parameter is not found, returns a null reference (Nothing in Visual Basic).

Remarks

This is similar to Remove(String, LockHandle) except that the operation is performed asynchronously. A ItemRemoved event is fired upon successful completion of this method.It is not possible to determine if the actual operation has failed, therefore use this operation for the cases when it does not matter much.

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.
 Copy imageCopy
OnAsyncItemRemoved(string key, object result)
{
...
}

NCache.Cache.RemoveAsync("timestamp", new AsyncItemRemovedCallback(OnAsyncItemRemoved));
Or simply in a class deriving from [!:Alachisoft.NCache.Web.UI.NPage] or [!:Alachisoft.NCache.Web.UI.NUserControl].
 Copy imageCopy
Cache.RemoveAsync("timestamp", new AsyncItemRemovedCallback(OnAsyncItemRemoved));

Exceptions

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

See Also