Removes the object from the Cache.
Namespace: Alachisoft.NCache.Web.CachingAssembly: Alachisoft.NCache.Web (in Alachisoft.NCache.Web.dll) Version: 4.1.0.0 (4.1.0.0)
Syntax
C# |
---|
public override Object Remove( string key, DSWriteOption dsWriteOption, DataSourceItemsRemovedCallback onDataSourceItemRemovedCallback ) |
Visual Basic |
---|
Public Overrides Function Remove ( _ key As String, _ dsWriteOption As DSWriteOption, _ onDataSourceItemRemovedCallback As DataSourceItemsRemovedCallback _ ) As Object |
Visual C++ |
---|
public: virtual Object^ Remove( String^ key, DSWriteOption dsWriteOption, DataSourceItemsRemovedCallback^ onDataSourceItemRemovedCallback ) override |
Parameters
- key
- Type: System..::..String
The cache key used to reference the item.
- dsWriteOption
- Type: Alachisoft.NCache.Web.Caching..::..DSWriteOption
Options regarding updating data source
- onDataSourceItemRemovedCallback
- Type: Alachisoft.NCache.Web.Caching..::..DataSourceItemsRemovedCallback
Return Value
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
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.
Or simply in a class deriving from [!:Alachisoft.NCache.Web.UI.NPage] or [!:Alachisoft.NCache.Web.UI.NUserControl].
CopyC#
NCache.Cache.Remove("timestamp");
CopyC#
Cache.Remove("timestamp");
Exceptions
Exception | Condition |
---|---|
System..::..ArgumentNullException | key contains a null reference (Nothing in Visual Basic). |
System..::..ArgumentException | key is not serializable. |