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 |
---|---|---|
IDistributedCache | distributedCache | The distributed cache. |
System.String | key | The key. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<T> | A System.Threading.Tasks.Task that represents outstanding operation. The result of the Task is the value returned by the cache. |
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 |
---|---|---|
IDistributedCache | distributedCache | The distributed cache. |
System.String | key | The key. |
T | value | The value. |
DistributedCacheEntryOptions | options | The distributed cache entry options. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents outstanding operation. |
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 |
---|---|---|
IDistributedCache | distributedCache | The distributed cache. |
System.String | key | The key. |
T | value | The value. |
System.Threading.CancellationToken | cancellationToken | The cancellation token. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task that represents outstanding operation. |
Type Parameters
Name | Description |
---|---|
T | The value type. |