MemoryCacheEntryExtensions.SetAbsoluteExpiration 方法

定义

重载

SetAbsoluteExpiration(MemoryCacheEntryOptions, DateTimeOffset)

为缓存项设置一个绝对到期日期。

SetAbsoluteExpiration(MemoryCacheEntryOptions, TimeSpan)

设置一个相对于当前时间的绝对到期时间。

SetAbsoluteExpiration(MemoryCacheEntryOptions, DateTimeOffset)

Source:
MemoryCacheEntryExtensions.cs
Source:
MemoryCacheEntryExtensions.cs

为缓存项设置一个绝对到期日期。

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

参数

absolute
DateTimeOffset

绝对到期时间。

返回

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

适用于

SetAbsoluteExpiration(MemoryCacheEntryOptions, TimeSpan)

Source:
MemoryCacheEntryExtensions.cs
Source:
MemoryCacheEntryExtensions.cs

设置一个相对于当前时间的绝对到期时间。

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

参数

relative
TimeSpan

相对于当前时间的到期时间。

返回

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

适用于