ObjectCache.Remove(String, String) ObjectCache.Remove(String, String) 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 = null);
abstract member Remove : string * string -> obj
Public MustOverride Function Remove (key As String, Optional regionName As String = null) As Object


String String String

该缓存项的唯一标识符。A unique identifier for the cache entry.

String String String

可选。Optional. 缓存中添加了缓存项的命名区域(如果实现了区域)。A named region in the cache to which the cache entry was added, if regions are implemented. 可选参数的默认值为 nullThe default value for the optional parameter is null.


一个对象,表示由该键指定的已移除缓存项的值;如果找不到指定的项,则为 nullAn 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.


如果您重写此方法在自定义缓存实现中,如果对应于在缓存中没有某个缓存项key,应返回已移除的项的值。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. 如果不从缓存中删除,该方法应返回nullIf 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. 在这种情况下,缓存实现可以返回nullIn such cases, cache implementations can return null.