ICacheEntry 介面

定義

代表 IMemoryCache 實作中的項目。Represents an entry in the IMemoryCache implementation.

public interface class ICacheEntry : IDisposable
public interface ICacheEntry : IDisposable
type ICacheEntry = interface
    interface IDisposable
Public Interface ICacheEntry
Implements IDisposable
實作

屬性

AbsoluteExpiration

取得或設定快取項目的絕對到期日。Gets or sets an absolute expiration date for the cache entry.

AbsoluteExpirationRelativeToNow

取得或設定相對於 now 的絕對到期時間。Gets or sets an absolute expiration time, relative to now.

ExpirationTokens

取得導致快取項目過期的 IChangeToken 執行個體。Gets the IChangeToken instances which cause the cache entry to expire.

Key

取得快取項目的索引鍵。Gets the key of the cache entry.

PostEvictionCallbacks

取得或設定從快取收回快取項目後,將會引發的回呼。Gets or sets the callbacks will be fired after the cache entry is evicted from the cache.

Priority

取得或設定於清除期間將快取項目保留在快取中的優先順序。Gets or sets the priority for keeping the cache entry in the cache during a cleanup. 預設為 NormalThe default is Normal.

Size

取得或設定快取項目值的大小。Gets or set the size of the cache entry value.

SlidingExpiration

取得或設定快取項目在移除前可處於非使用中狀態的時間長度 (例如,未經存取)。Gets or sets how long a cache entry can be inactive (e.g. not accessed) before it will be removed. 這不會讓項目存留期超過絕對到期的時間 (如已設定)。This will not extend the entry lifetime beyond the absolute expiration (if set).

Value

取得或設定快取項目的值。Gets or set the value of the cache entry.

方法

Dispose()

執行與釋放 (Free)、釋放 (Release) 或重設 Unmanaged 資源相關聯之應用程式定義的工作。Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

(繼承來源 IDisposable)

擴充方法

AddExpirationToken(ICacheEntry, IChangeToken)

如果指定的 IChangeToken 過期,快取項目即過期。Expire the cache entry if the given IChangeToken expires.

RegisterPostEvictionCallback(ICacheEntry, PostEvictionDelegate)

從快取收回快取項目後,將會引發的指定回呼。The given callback will be fired after the cache entry is evicted from the cache.

RegisterPostEvictionCallback(ICacheEntry, PostEvictionDelegate, Object)

從快取收回快取項目後,將會引發的指定回呼。The given callback will be fired after the cache entry is evicted from the cache.

SetAbsoluteExpiration(ICacheEntry, DateTimeOffset)

設定快取項目的絕對到期日。Sets an absolute expiration date for the cache entry.

SetAbsoluteExpiration(ICacheEntry, TimeSpan)

設定相對於 now 的絕對到期時間。Sets an absolute expiration time, relative to now.

SetOptions(ICacheEntry, MemoryCacheEntryOptions)

將現有的 MemoryCacheEntryOptions 值套用至項目。Applies the values of an existing MemoryCacheEntryOptions to the entry.

SetPriority(ICacheEntry, CacheItemPriority)

設定於設定記憶體壓力權杖清除期間,將快取項目保留在快取中的優先順序。Sets the priority for keeping the cache entry in the cache during a memory pressure tokened cleanup.

SetSize(ICacheEntry, Int64)

設定快取項目值的大小。Sets the size of the cache entry value.

SetSlidingExpiration(ICacheEntry, TimeSpan)

或設定快取項目在移除前可處於非使用中狀態的時間長度 (例如,未經存取)。Sets how long the cache entry can be inactive (e.g. not accessed) before it will be removed. 這不會讓項目存留期超過絕對到期的時間 (如已設定)。This will not extend the entry lifetime beyond the absolute expiration (if set).

SetValue(ICacheEntry, Object)

設定快取項目的值。Sets the value of the cache entry.

適用於