Class MethodCommonDistributedCacheExtensions
Inheritance
System.Object
MethodCommonDistributedCacheExtensions
Namespace: Microsoft.Extensions.Caching.Distributed
Assembly: Copper.Conventions.Method.Common.dll
Syntax
public static class MethodCommonDistributedCacheExtensions
Methods
View SourceGetAsync<T>(IDistributedCache, String)
Gets a value with the given key.
Declaration
public static async Task<T> GetAsync<T>(this IDistributedCache distributedCache, string key)
where T : class
Parameters
Type | Name | Description |
---|---|---|
IDistributed |
distributedCache | The distributed cache. |
System. |
key | The key. |
Returns
Type | Description |
---|---|
System. |
A System. |
Type Parameters
Name | Description |
---|---|
T | The value type. |
SetAsync<T>(IDistributedCache, String, T, DistributedCacheEntryOptions, CancellationToken)
Asynchronously sets a value in the specified cache with the specified key.
Declaration
public static async Task SetAsync<T>(this IDistributedCache distributedCache, string key, T value, DistributedCacheEntryOptions options, CancellationToken cancellationToken = default(CancellationToken))
where T : class
Parameters
Type | Name | Description |
---|---|---|
IDistributed |
distributedCache | The distributed cache. |
System. |
key | The key. |
T | value | The value. |
Distributed |
options | The distributed cache entry options. |
System. |
cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System. |
A System. |
Type Parameters
Name | Description |
---|---|
T | The value type. |
SetAsync<T>(IDistributedCache, String, T, CancellationToken)
Asynchronously sets a value in the specified cache with the specified key.
Declaration
public static async Task SetAsync<T>(this IDistributedCache distributedCache, string key, T value, CancellationToken cancellationToken = default(CancellationToken))
where T : class
Parameters
Type | Name | Description |
---|---|---|
IDistributed |
distributedCache | The distributed cache. |
System. |
key | The key. |
T | value | The value. |
System. |
cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System. |
A System. |
Type Parameters
Name | Description |
---|---|
T | The value type. |