Removes all elements 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 ClearAsync(
	AsyncCacheClearedCallback onAsyncCacheClearCallback
)
Visual Basic
Public Overrides Sub ClearAsync ( 
	onAsyncCacheClearCallback As AsyncCacheClearedCallback
)
Visual C++
public:
virtual void ClearAsync(
	AsyncCacheClearedCallback^ onAsyncCacheClearCallback
) override

Parameters

onAsyncCacheClearCallback
Type: Alachisoft.NCache.Web.Caching..::..AsyncCacheClearedCallback

Remarks

This is similar to Clear(DSWriteOption, DataSourceClearedCallback) except that the operation is performed asynchronously. A CacheCleared 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.

A delegate that, that can be used to get the result of the Asynchronous Clear operation.Options regarding updating data source

Examples

The following example demonstrates how to clear the Cache.
 Copy imageCopy
void OnAsyncCacheCleared(object result)
{
...
}

NCache.Cache.ClearAsync(new AsyncCacheClearedCallback(OnAsyncCacheCleared));
Or simply in a class deriving from [!:Alachisoft.NCache.Web.UI.NPage] or [!:Alachisoft.NCache.Web.UI.NUserControl].
 Copy imageCopy
Cache.ClearAsync(new AsyncCacheClearedCallback(OnAsyncCacheCleared));

See Also