Share via


MemoryCacheEntryExtensions.SetAbsoluteExpiration Method

Definition

Overloads

SetAbsoluteExpiration(MemoryCacheEntryOptions, DateTimeOffset)

Sets an absolute expiration date for the cache entry.

SetAbsoluteExpiration(MemoryCacheEntryOptions, TimeSpan)

Sets an absolute expiration time, relative to now.

SetAbsoluteExpiration(MemoryCacheEntryOptions, DateTimeOffset)

Source:
MemoryCacheEntryExtensions.cs
Source:
MemoryCacheEntryExtensions.cs
Source:
MemoryCacheEntryExtensions.cs

Sets an absolute expiration date for the cache entry.

public static Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions SetAbsoluteExpiration(this Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions options, DateTimeOffset absolute);

Parameters

absolute
DateTimeOffset

The expiration time, in absolute terms.

Returns

The MemoryCacheEntryOptions so that additional calls can be chained.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)

SetAbsoluteExpiration(MemoryCacheEntryOptions, TimeSpan)

Source:
MemoryCacheEntryExtensions.cs
Source:
MemoryCacheEntryExtensions.cs
Source:
MemoryCacheEntryExtensions.cs

Sets an absolute expiration time, relative to now.

public static Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions SetAbsoluteExpiration(this Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions options, TimeSpan relative);

Parameters

relative
TimeSpan

The expiration time, relative to now.

Returns

The MemoryCacheEntryOptions so that additional calls can be chained.

Applies to

.NET 10 (package-provided) and other versions
Product Versions
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Standard 2.0 (package-provided)