MemoryCacheEntryExtensions.SetSlidingExpiration 方法

定义

设置缓存项在被删除之前可以处于停用状态(例如不被访问)的时长。 这不会将项生存期延长到超过绝对到期时间(如果已设置)。

public:
[System::Runtime::CompilerServices::Extension]
 static Microsoft::Extensions::Caching::Memory::MemoryCacheEntryOptions ^ SetSlidingExpiration(Microsoft::Extensions::Caching::Memory::MemoryCacheEntryOptions ^ options, TimeSpan offset);
public static Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions SetSlidingExpiration (this Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions options, TimeSpan offset);
static member SetSlidingExpiration : Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions * TimeSpan -> Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions
<Extension()>
Public Function SetSlidingExpiration (options As MemoryCacheEntryOptions, offset As TimeSpan) As MemoryCacheEntryOptions

参数

offset
TimeSpan

可调到期时间。

返回

MemoryCacheEntryOptions,以便可以链接其他调用。

适用于