MemoryCache.Remove 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
从缓存中删除指定的项。
重载
| 名称 | 说明 |
|---|---|
| Remove(String, String) |
从缓存中删除缓存项。 |
| Remove(String, CacheEntryRemovedReason, String) |
使用原因从缓存中删除缓存条目。 |
Remove(String, String)
- Source:
- MemoryCache.cs
- Source:
- MemoryCache.cs
- Source:
- MemoryCache.cs
- Source:
- MemoryCache.cs
从缓存中删除缓存项。
public override object Remove(string key, string regionName = default);
override this.Remove : string * string -> obj
Public Overrides Function Remove (key As String, Optional regionName As String = Nothing) As Object
参数
- key
- String
要删除的缓存项的唯一标识符。
- regionName
- String
缓存中已添加缓存项的命名区域。 不要传递此参数的值。
null此参数默认为,因为MemoryCache该类不实现区域。
返回
如果在缓存中找到该项,则删除的缓存项;否则,为 null.
例外
regionName 不是 null。
key 是 null。
注解
如果缓存中存在指定的 key 项,则删除该项将触发任何关联的更改监视器。 如果已删除的项与 CacheItemUpdateCallback 对象或 CacheItemRemovedCallback 对象相关联,则传递给回调的原因为 Removed。
适用于
Remove(String, CacheEntryRemovedReason, String)
- Source:
- MemoryCache.cs
- Source:
- MemoryCache.cs
- Source:
- MemoryCache.cs
- Source:
- MemoryCache.cs
使用原因从缓存中删除缓存条目。
public object Remove(string key, System.Runtime.Caching.CacheEntryRemovedReason reason, string regionName = default);
override this.Remove : string * System.Runtime.Caching.CacheEntryRemovedReason * string -> obj
Public Function Remove (key As String, reason As CacheEntryRemovedReason, Optional regionName As String = Nothing) As Object
参数
- key
- String
要删除的缓存项的唯一标识符。
- reason
- CacheEntryRemovedReason
删除项的原因。
- regionName
- String
缓存中已添加缓存项的命名区域。 不要传递此参数的值。
null此参数默认为,因为MemoryCache该类不实现区域。
返回
如果在缓存中找到该项,则删除的缓存项;否则,为 null.