ObjectCache.Remove(String, String) Method


When overridden in a derived class, removes the cache entry from the cache.

public abstract object Remove (string key, string regionName = default);
abstract member Remove : string * string -> obj
Public MustOverride Function Remove (key As String, Optional regionName As String = Nothing) As Object



A unique identifier for the cache entry.


Optional. A named region in the cache to which the cache entry was added, if regions are implemented. The default value for the optional parameter is null.



An object that represents the value of the removed cache entry that was specified by the key, or null if the specified entry was not found.


If you override this method in a custom cache implementation, if there is a cache entry in the cache that corresponds to key, the value of the removed item should be returned. If nothing was removed from the cache, the method should return null.


Some distributed cache implementations might not support the ability to return the value that was removed from the cache. This might be because the cache implementation does not support returning the value of a removed cache item. It might also be because marshaling the object as a return value is too expensive. In such cases, cache implementations can return null.

Applies to