Removes all elements from the Cache.

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#
[ObsoleteAttribute("This method is deprecated. 'Please use Clear()'", 
	false)]
public virtual void Clear(
	DSWriteOption updateOpt,
	DataSourceClearedCallback dataSourceClearedCallback
)
Visual Basic
<ObsoleteAttribute("This method is deprecated. 'Please use Clear()'", 
	false)> 
Public Overridable Sub Clear ( 
	updateOpt As DSWriteOption,
	dataSourceClearedCallback As DataSourceClearedCallback
)
Visual C++
public:
[ObsoleteAttribute(L"This method is deprecated. 'Please use Clear()'", 
	false)]
virtual void Clear(
	DSWriteOption updateOpt, 
	DataSourceClearedCallback^ dataSourceClearedCallback
)

Parameters

updateOpt
Type: Alachisoft.NCache.Web.Caching..::..DSWriteOption
Options regarding updating data source
dataSourceClearedCallback
Type: Alachisoft.NCache.Web.Caching..::..DataSourceClearedCallback
A delegate that, if provided, is called when data source is cleared.

Remarks

In most of the cases this method's implementation is close to O(1).

Note: If exceptions are enabled through the ExceptionsEnabled setting, this property throws exception incase of failure.

Examples

The following example demonstrates how to clear the Cache.
 Copy imageCopy
OnDataSourceCleared(object result)
{
...
}
Cache cache = NCache.InitializeCache("myCache");
cache.Clear(DSWriteOption.WriteBehind, new DataSourceClearedCallback(OnDataSourceCleared));

See Also