DistributedCacheEntryOptions 类

定义

IDistributedCache 中的项提供缓存选项。Provides the cache options for an entry in IDistributedCache.

public ref class DistributedCacheEntryOptions
public class DistributedCacheEntryOptions
type DistributedCacheEntryOptions = class
Public Class DistributedCacheEntryOptions
继承
DistributedCacheEntryOptions

构造函数

DistributedCacheEntryOptions()

属性

AbsoluteExpiration

获取或设置缓存项的绝对到期日期。Gets or sets an absolute expiration date for the cache entry.

AbsoluteExpirationRelativeToNow

获取或设置相对于当前时间的绝对到期时间。Gets or sets an absolute expiration time, relative to now.

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).

方法

Equals(Object)

确定指定对象是否等于当前对象。Determines whether the specified object is equal to the current object.

(继承自 Object)
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)
ToString()

返回表示当前对象的字符串。Returns a string that represents the current object.

(继承自 Object)

扩展方法

SetAbsoluteExpiration(DistributedCacheEntryOptions, DateTimeOffset)

为缓存项设置一个绝对到期日期。Sets an absolute expiration date for the cache entry.

SetAbsoluteExpiration(DistributedCacheEntryOptions, TimeSpan)

设置一个相对于当前时间的绝对到期时间。Sets an absolute expiration time, relative to now.

SetSlidingExpiration(DistributedCacheEntryOptions, 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).

适用于