Early Preview

This is currently very much a preview. Please feel free to try things out, but don't be upset if anything is not yet working. Feedback is welcome over on our GitHub Dicussions page.

class Microsoft.​Extensions.​Caching.​Memory.​MemoryCacheEntryExtensions

Assembly: Microsoft.Extensions.Caching.Abstractions

Inheritance: object → MemoryCacheEntryExtensions

Provide extensions methods for <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> operations.

Methods

public static MemoryCacheEntryOptions
AddExpirationToken​(MemoryCacheEntryOptions options, Primitives.​IChangeToken expirationToken)
Expires the cache entry if the given <see cref="T:Microsoft.Extensions.Primitives.IChangeToken" /> expires.
Returns The <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> so that additional calls can be chained.
options The <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> .
expirationToken The <see cref="T:Microsoft.Extensions.Primitives.IChangeToken" /> that causes the cache entry to expire.
public static MemoryCacheEntryOptions
RegisterPostEvictionCallback​(MemoryCacheEntryOptions options, PostEvictionDelegate callback)
Fires the given callback after the cache entry is evicted from the cache.
Returns The <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> so that additional calls can be chained.
options The <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> .
callback The callback to register for calling after an entry is evicted.
public static MemoryCacheEntryOptions
RegisterPostEvictionCallback​(MemoryCacheEntryOptions options, PostEvictionDelegate callback, object state)
Fires the given callback after the cache entry is evicted from the cache.
Returns The <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> so that additional calls can be chained.
options The <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> .
callback The callback to register for calling after an entry is evicted.
state The state to pass to the callback.
public static MemoryCacheEntryOptions
SetAbsoluteExpiration​(MemoryCacheEntryOptions options, System.​DateTimeOffset absolute)
Sets an absolute expiration date for the cache entry.
Returns The <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> so that additional calls can be chained.
options The <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> .
absolute The expiration time, in absolute terms.
public static MemoryCacheEntryOptions
SetAbsoluteExpiration​(MemoryCacheEntryOptions options, System.​TimeSpan relative)
Sets an absolute expiration time, relative to now.
Returns The <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> so that additional calls can be chained.
options The <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> .
relative The expiration time, relative to now.
public static MemoryCacheEntryOptions
SetPriority​(MemoryCacheEntryOptions options, CacheItemPriority priority)
Sets the priority for keeping the cache entry in the cache during a memory pressure tokened cleanup.
Returns The <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> so that additional calls can be chained.
options The option on which to set the priority.
priority The <see cref="T:Microsoft.Extensions.Caching.Memory.CacheItemPriority" /> to set on the option.
public static MemoryCacheEntryOptions
SetSize​(MemoryCacheEntryOptions options, long size)
Sets the size of the cache entry value.
Returns The <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> so that additional calls can be chained.
options The options to set the entry size on.
size The size to set on the <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> .
public static MemoryCacheEntryOptions
SetSlidingExpiration​(MemoryCacheEntryOptions options, System.​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).
Returns The <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> so that additional calls can be chained.
options The <see cref="T:Microsoft.Extensions.Caching.Memory.MemoryCacheEntryOptions" /> .
offset The sliding expiration time.
public bool
Equals​(object obj)
Inherited from object
protected void
Finalize​()
Inherited from object
public int
GetHashCode​()
Inherited from object
GetType​()
Inherited from object
protected object
MemberwiseClone​()
Inherited from object
public string
ToString​()
Inherited from object