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

获取或设置相对于当前时间的绝对到期时间。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()

执行与释放或重置非托管资源关联的应用程序定义的任务。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)

设置一个相对于当前时间的绝对到期时间。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.

适用于