<PackageReference Include="Microsoft.Extensions.Caching.Abstractions" Version="10.0.12" />

Microsoft.Extensions.Caching.Memory.MemoryCacheEntryExtensions

public static class MemoryCacheEntryExtensions
Provide extensions methods for MemoryCacheEntryOptions operations.
public static MemoryCacheEntryOptions AddExpirationToken(this MemoryCacheEntryOptions options, IChangeToken expirationToken)

Expires the cache entry if the given IChangeToken expires.

Fires the given callback after the cache entry is evicted from the cache.

Fires the given callback after the cache entry is evicted from the cache.

Sets an absolute expiration time, relative to now.

Sets an absolute expiration date for the cache entry.

Sets the priority for keeping the cache entry in the cache during a memory pressure tokened cleanup.

public static MemoryCacheEntryOptions SetSize(this MemoryCacheEntryOptions options, long size)

Sets the size of the cache entry value.

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).