MemoryCache 類別

定義

使用字典儲存其項目的 IMemoryCache 實作。An implementation of IMemoryCache using a dictionary to store its entries.

public ref class MemoryCache : IDisposable, Microsoft::Extensions::Caching::Memory::IMemoryCache
public class MemoryCache : IDisposable, Microsoft.Extensions.Caching.Memory.IMemoryCache
type MemoryCache = class
    interface IMemoryCache
    interface IDisposable
Public Class MemoryCache
Implements IDisposable, IMemoryCache
繼承
MemoryCache
實作

建構函式

MemoryCache(IOptions<MemoryCacheOptions>)

建立新的 MemoryCache 執行個體。Creates a new MemoryCache instance.

MemoryCache(IOptions<MemoryCacheOptions>, ILoggerFactory)

建立新的 MemoryCache 執行個體。Creates a new MemoryCache instance.

屬性

Count

取得目前項目的計數,以供診斷之用。Gets the count of the current entries for diagnostic purposes.

方法

Compact(Double)
CreateEntry(Object)
Dispose()
Dispose(Boolean)
Equals(Object)

判斷指定的物件是否等於目前的物件。Determines whether the specified object is equal to the current object.

(繼承來源 Object)
Finalize()

清除背景集合事件。Cleans up the background collection events.

GetHashCode()

作為預設雜湊函數。Serves as the default hash function.

(繼承來源 Object)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
Remove(Object)
ToString()

傳回代表目前物件的字串。Returns a string that represents the current object.

(繼承來源 Object)
TryGetValue(Object, Object)

擴充方法

Get(IMemoryCache, Object)
Get<TItem>(IMemoryCache, Object)
GetOrCreate<TItem>(IMemoryCache, Object, Func<ICacheEntry,TItem>)
GetOrCreateAsync<TItem>(IMemoryCache, Object, Func<ICacheEntry,Task<TItem>>)
Set<TItem>(IMemoryCache, Object, TItem)
Set<TItem>(IMemoryCache, Object, TItem, MemoryCacheEntryOptions)
Set<TItem>(IMemoryCache, Object, TItem, IChangeToken)
Set<TItem>(IMemoryCache, Object, TItem, DateTimeOffset)
Set<TItem>(IMemoryCache, Object, TItem, TimeSpan)
TryGetValue<TItem>(IMemoryCache, Object, TItem)

適用於