MemoryCache.Contains(String, String) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
判斷快取專案是否存在於快取中。
public override bool Contains(string key, string regionName = default);
override this.Contains : string * string -> bool
Public Overrides Function Contains (key As String, Optional regionName As String = Nothing) As Boolean
參數
- key
- String
一個用於搜尋快取項目的唯一識別碼。
- regionName
- String
快取中被新增快取條目的命名區域。 不要傳遞該參數的值。 這個參數是 null 預設的,因為該 MemoryCache 類別不實作區域。
傳回
true 若快取包含一個快取條目,且其鍵與 key;否則,則 false。
例外狀況
key 是 null。
regionName 不是 null。