DistributedCacheEntryExtensions Class

Namespace
Microsoft.Extensions.Caching.Distributed
Assemblies
  • Microsoft.Extensions.Caching.Abstractions

Syntax

public class DistributedCacheEntryExtensions
class Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryExtensions

Methods

SetAbsoluteExpiration(Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions, System.DateTimeOffset)

Sets an absolute expiration date for the cache entry.

Return type:Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions
public static DistributedCacheEntryOptions SetAbsoluteExpiration(this DistributedCacheEntryOptions options, DateTimeOffset absolute)
SetAbsoluteExpiration(Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions, System.TimeSpan)

Sets an absolute expiration time, relative to now.

Return type:Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions
public static DistributedCacheEntryOptions SetAbsoluteExpiration(this DistributedCacheEntryOptions options, TimeSpan relative)
SetSlidingExpiration(Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions, System.TimeSpan)

Sets how long the cache entry can be inactive (e.g. not accessed) before it will be removed. This will not extend the entry lifetime beyond the absolute expiration (if set).

Return type:Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions
public static DistributedCacheEntryOptions SetSlidingExpiration(this DistributedCacheEntryOptions options, TimeSpan offset)