CacheEntryExtensions.SetAbsoluteExpiration 方法

定义

重载

SetAbsoluteExpiration(ICacheEntry, DateTimeOffset)

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

SetAbsoluteExpiration(ICacheEntry, TimeSpan)

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

SetAbsoluteExpiration(ICacheEntry, DateTimeOffset)

Source:
CacheEntryExtensions.cs
Source:
CacheEntryExtensions.cs
Source:
CacheEntryExtensions.cs

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

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

参数

absolute
DateTimeOffset

以绝对项表示到期时间的 DateTimeOffset

返回

用于链接的 ICacheEntry

适用于

SetAbsoluteExpiration(ICacheEntry, TimeSpan)

Source:
CacheEntryExtensions.cs
Source:
CacheEntryExtensions.cs
Source:
CacheEntryExtensions.cs

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

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

参数

relative
TimeSpan

TimeSpan,表示相对于当前时间的到期时间。

返回

用于链接的 ICacheEntry

适用于