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.

interface Microsoft.​Extensions.​Caching.​Distributed.​IDistributedCache

Assembly: Microsoft.Extensions.Caching.Abstractions

Represents a distributed cache of serialized values.

Methods

byte[]
Get​(string key)
Gets a value with the given key.
Returns The located value or null.
key A string identifying the requested value.
GetAsync​(string key, System.​Threading.​CancellationToken token = null)
Gets a value with the given key.
Returns The <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation, containing the located value or null.
key A string identifying the requested value.
token Optional. The <see cref="T:System.Threading.CancellationToken" /> used to propagate notifications that the operation should be canceled.
void
Refresh​(string key)
Refreshes a value in the cache based on its key, resetting its sliding expiration timeout (if any).
key A string identifying the requested value.
RefreshAsync​(string key, System.​Threading.​CancellationToken token = null)
Refreshes a value in the cache based on its key, resetting its sliding expiration timeout (if any).
Returns The <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
key A string identifying the requested value.
token Optional. The <see cref="T:System.Threading.CancellationToken" /> used to propagate notifications that the operation should be canceled.
void
Remove​(string key)
Removes the value with the given key.
key A string identifying the requested value.
RemoveAsync​(string key, System.​Threading.​CancellationToken token = null)
Removes the value with the given key.
Returns The <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
key A string identifying the requested value.
token Optional. The <see cref="T:System.Threading.CancellationToken" /> used to propagate notifications that the operation should be canceled.
void
Set​(string key, byte[] value, DistributedCacheEntryOptions options)
Sets a value with the given key.
key A string identifying the requested value.
value The value to set in the cache.
options The cache options for the value.
SetAsync​(string key, byte[] value, DistributedCacheEntryOptions options, System.​Threading.​CancellationToken token = null)
Sets the value with the given key.
Returns The <see cref="T:System.Threading.Tasks.Task" /> that represents the asynchronous operation.
key A string identifying the requested value.
value The value to set in the cache.
options The cache options for the value.
token Optional. The <see cref="T:System.Threading.CancellationToken" /> used to propagate notifications that the operation should be canceled.