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 Object Remove( string key ) |
Visual Basic |
---|
Public Function Remove ( _ key As String _ ) As Object |
Visual C++ |
---|
public: Object^ Remove( String^ key ) |
Parameters
- key
- Type: System..::..String
The cache key used to reference the item.
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.
CopyC#
Cache cache = NCache.InitializeCache("myCache"); cache.Remove("timestamp");
Exceptions
Exception | Condition |
---|---|
System..::..ArgumentNullException | key contains a null reference (Nothing in Visual Basic). |
System..::..ArgumentException | key is not serializable. |