CacheExtensions 類別

定義

提供作業的 IMemoryCache 擴充方法。

public ref class CacheExtensions abstract sealed
public static class CacheExtensions
type CacheExtensions = class
Public Module CacheExtensions
繼承
CacheExtensions

方法

Get(IMemoryCache, Object)

如果存在,取得與這個索引鍵相關聯的值。

Get<TItem>(IMemoryCache, Object)

如果存在,取得與這個索引鍵相關聯的值。

GetOrCreate<TItem>(IMemoryCache, Object, Func<ICacheEntry,TItem>)

如果索引鍵存在,則取得與這個索引鍵相關聯的值,或是使用提供的索引鍵產生新的專案,如果找不到索引鍵,則會從指定的處理站產生值。

GetOrCreate<TItem>(IMemoryCache, Object, Func<ICacheEntry,TItem>, MemoryCacheEntryOptions)

提供作業的 IMemoryCache 擴充方法。

GetOrCreateAsync<TItem>(IMemoryCache, Object, Func<ICacheEntry,Task<TItem>>)

如果索引鍵存在,則以異步方式取得與此索引鍵相關聯的值,或者如果找不到索引鍵,則會使用提供的索引鍵和來自指定處理站的值產生新的專案。

GetOrCreateAsync<TItem>(IMemoryCache, Object, Func<ICacheEntry,Task<TItem>>, MemoryCacheEntryOptions)

提供作業的 IMemoryCache 擴充方法。

Set<TItem>(IMemoryCache, Object, TItem)

將值與 中的 IMemoryCache指定索引鍵產生關聯。

Set<TItem>(IMemoryCache, Object, TItem, DateTimeOffset)

建立或覆寫快取中指定的專案,並以絕對到期日設定值。

Set<TItem>(IMemoryCache, Object, TItem, IChangeToken)

將快取專案與到期時 IChangeToken 到期的指定索引鍵產生關聯。

Set<TItem>(IMemoryCache, Object, TItem, MemoryCacheEntryOptions)

將快取專案與指定的索引鍵產生關聯,並將現有 MemoryCacheEntryOptions 的值套用至所建立的專案。

Set<TItem>(IMemoryCache, Object, TItem, TimeSpan)

將快取專案與指定的索引鍵建立關聯,該索引鍵將在指定的持續時間之後到期。

TryGetValue<TItem>(IMemoryCache, Object, TItem)

嘗試取得與指定索引鍵相關聯的值。

適用於