MemoryCache.Get(String, String) 方法

定義

從快取傳回項目。Returns an entry from the cache.

public override object Get (string key, string regionName = default);
override this.Get : string * string -> obj
Public Overrides Function Get (key As String, Optional regionName As String = null) As Object

參數

key
String

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

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.

傳回

如果由 key 所識別的快取項目存在,則為該快取項目的參考,否則為 nullA reference to the cache entry that is identified by key, if the entry exists; otherwise, null.

例外狀況

regionName 不是 nullregionName is not null.

keynullkey is null.

適用於