Microsoft.Extensions.Caching.Memory.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.
public static MemoryCacheEntryOptions RegisterPostEvictionCallback(this MemoryCacheEntryOptions options, PostEvictionDelegate callback)
Fires the given callback after the cache entry is evicted from the cache.
public static MemoryCacheEntryOptions RegisterPostEvictionCallback(this MemoryCacheEntryOptions options, PostEvictionDelegate callback, object state)
Fires the given callback after the cache entry is evicted from the cache.
public static MemoryCacheEntryOptions SetAbsoluteExpiration(this MemoryCacheEntryOptions options, TimeSpan relative)
Sets an absolute expiration time, relative to now.
public static MemoryCacheEntryOptions SetAbsoluteExpiration(this MemoryCacheEntryOptions options, DateTimeOffset absolute)
Sets an absolute expiration date for the cache entry.
public static MemoryCacheEntryOptions SetPriority(this MemoryCacheEntryOptions options, CacheItemPriority priority)
Sets the priority for keeping the cache entry in the cache during a memory pressure tokened cleanup.
Sets the size of the cache entry value.
public static MemoryCacheEntryOptions SetSlidingExpiration(this MemoryCacheEntryOptions options, TimeSpan offset)
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).