ObjectCache.GetCacheItem(String, String) 方法

定义

在派生类中重写时,从缓存中获取指定缓存条目作为 CacheItem 实例。

public abstract System.Runtime.Caching.CacheItem GetCacheItem(string key, string regionName = default);
abstract member GetCacheItem : string * string -> System.Runtime.Caching.CacheItem
Public MustOverride Function GetCacheItem (key As String, Optional regionName As String = Nothing) As CacheItem

参数

key
String

要获取的缓存项的唯一标识符。

regionName
String

Optional. 如果实现了区域,则缓存中已向其添加缓存的命名区域。 由于区域未在 .NET Framework 4 中实现,因此默认值为 null

返回

key.. 标识的缓存项。

注解

此方法重载存在,因为某些缓存实现可能会扩展 CacheItem 类。 在这种情况下, Get(String, String) 方法重载不一定返回有关缓存数据的所有信息。 但是,该方法 GetCacheItem(String, String) 重载使自定义缓存不仅返回缓存值,

该方法 GetCacheItem(String, String) 与该方法类似 Get(String, String) ,只不过 GetCacheItem(String, String) 该方法返回缓存条目作为 CacheItem 实例。

适用于