PROPERTY
MemoryCacheEntryOptions.AbsoluteExpirationRelativeToNow
Sets a relative absolute lifetime for a memory-cache entry. Access does not extend this bound. Expiration does not establish freshness of the authoritative data. Requires the caching library or shared framework.
Formal Syntax & Structure
csharp syntaxcsharp
options.AbsoluteExpirationRelativeToNow = TimeSpan.FromMinutes(2);Working Example
Example Snippetcsharp
using System;using System.Collections.Generic;using System.Threading;using System.Threading.Tasks;using System.Threading.Channels;using Microsoft.Extensions.Caching.Memory;var options=new MemoryCacheEntryOptions{AbsoluteExpirationRelativeToNow=TimeSpan.FromMinutes(2)}; Console.WriteLine(options.AbsoluteExpirationRelativeToNow.Value.TotalMinutes); // 2