共用方式為


MemoryCache.Remove 方法

定義

從快取中移除指定的項目。

多載

Remove(String, String)

從快取中移除一個快取項目。

Remove(String, CacheEntryRemovedReason, String)

使用原因,從快取中移除快取項目。

Remove(String, String)

來源:
MemoryCache.cs
來源:
MemoryCache.cs
來源:
MemoryCache.cs
來源:
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

keynull

備註

如果 指定的 key 專案存在於快取中,移除專案會觸發任何相關聯的變更監視器。 如果已移除的項目與 CacheItemUpdateCallback 物件或 CacheItemRemovedCallback 物件相關聯,則傳遞至回呼的原因為 Removed

適用於

Remove(String, CacheEntryRemovedReason, String)

來源:
MemoryCache.cs
來源:
MemoryCache.cs
來源:
MemoryCache.cs
來源:
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

適用於