MemoryCache.Contains(String, String) 方法

定義

判斷快取項目是否存在於快取中。Determines whether a cache entry exists in the cache.

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 = null) As Boolean

參數

key
String

要搜尋之快取項目的唯一識別項。A unique identifier for the cache entry to search for.

regionName
String

快取區中的具名區域,已將快取項目加入其中。A named region in the cache to which a cache entry was added. 請勿傳遞這個參數的值。Do not pass a value for this parameter. 這個參數預設為 null,因為 MemoryCache 類別沒有實作區域。This parameter is null by default, because the MemoryCache class does not implement regions.

傳回

如果快取包含索引鍵符合 true 的快取項目則為 key,否則為 falsetrue if the cache contains a cache entry whose key matches key; otherwise, false.

例外狀況

keynullkey is null.

regionName 不是 nullregionName is not null.

適用於