Removes all elements 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 override void Clear(
	DSWriteOption updateOpt,
	DataSourceClearedCallback dataSourceClearedCallback
)
Visual Basic
Public Overrides Sub Clear ( _
	updateOpt As DSWriteOption, _
	dataSourceClearedCallback As DataSourceClearedCallback _
)
Visual C++
public:
virtual void Clear(
	DSWriteOption updateOpt, 
	DataSourceClearedCallback^ dataSourceClearedCallback
) override

Parameters

updateOpt
Type: Alachisoft.NCache.Web.Caching..::..DSWriteOption
Options regarding updating data source
dataSourceClearedCallback
Type: Alachisoft.NCache.Web.Caching..::..DataSourceClearedCallback

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.
CopyC#
NCache.Cache.Clear();
Or simply in a class deriving from [!:Alachisoft.NCache.Web.UI.NPage] or [!:Alachisoft.NCache.Web.UI.NUserControl].
CopyC#
Cache.Clear();

See Also