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.​Distributed.​DistributedCacheExtensions

Assembly: Microsoft.Extensions.Caching.Abstractions

Inheritance: object → DistributedCacheExtensions

Extension methods for setting data in an <see cref="T:Microsoft.Extensions.Caching.Distributed.IDistributedCache" /> .

Methods

public static string
GetString​(IDistributedCache cache, string key)
Gets a string from the specified cache with the specified key.
Returns The string value from the stored cache key.
cache The cache in which to store the data.
key The key to get the stored data for.
public static System.​Threading.​Tasks.​Task<​string>
GetStringAsync​(IDistributedCache cache, string key, System.​Threading.​CancellationToken token = null)
Asynchronously gets a string from the specified cache with the specified key.
Returns A task that gets the string value from the stored cache key.
cache The cache in which to store the data.
key The key to get the stored data for.
token Optional. A <see cref="T:System.Threading.CancellationToken" /> to cancel the operation.
public static void
Set​(IDistributedCache cache, string key, byte[] value)
Sets a sequence of bytes in the specified cache with the specified key.
cache The cache in which to store the data.
key The key to store the data in.
value The data to store in the cache.
SetAsync​(IDistributedCache cache, string key, byte[] value, System.​Threading.​CancellationToken token = null)
Asynchronously sets a sequence of bytes in the specified cache with the specified key.
Returns A task that represents the asynchronous set operation.
cache The cache in which to store the data.
key The key to store the data in.
value The data to store in the cache.
token Optional. A <see cref="T:System.Threading.CancellationToken" /> to cancel the operation.
public static void
SetString​(IDistributedCache cache, string key, string value)
Sets a string in the specified cache with the specified key.
cache The cache in which to store the data.
key The key to store the data in.
value The data to store in the cache.
public static void
SetString​(IDistributedCache cache, string key, string value, DistributedCacheEntryOptions options)
Sets a string in the specified cache with the specified key.
cache The cache in which to store the data.
key The key to store the data in.
value The data to store in the cache.
options The cache options for the entry.
SetStringAsync​(IDistributedCache cache, string key, string value, DistributedCacheEntryOptions options, System.​Threading.​CancellationToken token = null)
Asynchronously sets a string in the specified cache with the specified key.
Returns A task that represents the asynchronous set operation.
cache The cache in which to store the data.
key The key to store the data in.
value The data to store in the cache.
options The cache options for the entry.
token Optional. A <see cref="T:System.Threading.CancellationToken" /> to cancel the operation.
SetStringAsync​(IDistributedCache cache, string key, string value, System.​Threading.​CancellationToken token = null)
Asynchronously sets a string in the specified cache with the specified key.
Returns A task that represents the asynchronous set operation.
cache The cache in which to store the data.
key The key to store the data in.
value The data to store in the cache.
token Optional. A <see cref="T:System.Threading.CancellationToken" /> to cancel the operation.
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