อ่านในภาษาอังกฤษ

แชร์ผ่าน


CacheEntryExtensions.SetAbsoluteExpiration Method

Definition

Overloads

SetAbsoluteExpiration(ICacheEntry, DateTimeOffset)

Sets an absolute expiration date for the cache entry.

SetAbsoluteExpiration(ICacheEntry, TimeSpan)

Sets an absolute expiration time, relative to now.

SetAbsoluteExpiration(ICacheEntry, DateTimeOffset)

Source:
CacheEntryExtensions.cs
Source:
CacheEntryExtensions.cs

Sets an absolute expiration date for the cache entry.

public static Microsoft.Extensions.Caching.Memory.ICacheEntry SetAbsoluteExpiration (this Microsoft.Extensions.Caching.Memory.ICacheEntry entry, DateTimeOffset absolute);

Parameters

absolute
DateTimeOffset

A DateTimeOffset representing the expiration time in absolute terms.

Returns

The ICacheEntry for chaining.

Applies to

.NET 9 (package-provided) และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
.NET 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)

SetAbsoluteExpiration(ICacheEntry, TimeSpan)

Source:
CacheEntryExtensions.cs
Source:
CacheEntryExtensions.cs

Sets an absolute expiration time, relative to now.

public static Microsoft.Extensions.Caching.Memory.ICacheEntry SetAbsoluteExpiration (this Microsoft.Extensions.Caching.Memory.ICacheEntry entry, TimeSpan relative);

Parameters

relative
TimeSpan

The TimeSpan representing the expiration time relative to now.

Returns

The ICacheEntry for chaining.

Applies to

.NET 9 (package-provided) และรุ่นอื่นๆ
ผลิตภัณฑ์ เวอร์ชัน
.NET 6 (package-provided), 7 (package-provided), 8 (package-provided), 9 (package-provided)
.NET Framework 4.7 (package-provided), 4.7.1 (package-provided), 4.7.2 (package-provided), 4.8 (package-provided)
.NET Standard 2.0 (package-provided)