DistributedCacheExtensions.GetStringAsync 方法
定义
重载
| GetStringAsync(IDistributedCache, String) |
使用指定的键从指定的缓存异步获取字符串。Asynchronously gets a string from the specified cache with the specified key. |
| GetStringAsync(IDistributedCache, String, CancellationToken) |
使用指定的键从指定的缓存异步获取字符串。Asynchronously gets a string from the specified cache with the specified key. |
GetStringAsync(IDistributedCache, String)
使用指定的键从指定的缓存异步获取字符串。Asynchronously gets a string from the specified cache with the specified key.
public:
[System::Runtime::CompilerServices::Extension]
static System::Threading::Tasks::Task<System::String ^> ^ GetStringAsync(Microsoft::Extensions::Caching::Distributed::IDistributedCache ^ cache, System::String ^ key);
public static System.Threading.Tasks.Task<string> GetStringAsync (this Microsoft.Extensions.Caching.Distributed.IDistributedCache cache, string key);
static member GetStringAsync : Microsoft.Extensions.Caching.Distributed.IDistributedCache * string -> System.Threading.Tasks.Task<string>
<Extension()>
Public Function GetStringAsync (cache As IDistributedCache, key As String) As Task(Of String)
参数
- cache
- IDistributedCache
用于存储数据的缓存。The cache in which to store the data.
- key
- String
要为其获取存储的数据的键。The key to get the stored data for.
返回
一个从存储的缓存键中获取字符串值的任务。A task that gets the string value from the stored cache key.
适用于
GetStringAsync(IDistributedCache, String, CancellationToken)
使用指定的键从指定的缓存异步获取字符串。Asynchronously gets a string from the specified cache with the specified key.
public static System.Threading.Tasks.Task<string> GetStringAsync (this Microsoft.Extensions.Caching.Distributed.IDistributedCache cache, string key, System.Threading.CancellationToken token = default);
static member GetStringAsync : Microsoft.Extensions.Caching.Distributed.IDistributedCache * string * System.Threading.CancellationToken -> System.Threading.Tasks.Task<string>
<Extension()>
Public Function GetStringAsync (cache As IDistributedCache, key As String, Optional token As CancellationToken = Nothing) As Task(Of String)
参数
- cache
- IDistributedCache
用于存储数据的缓存。The cache in which to store the data.
- key
- String
要为其获取存储的数据的键。The key to get the stored data for.
- token
- CancellationToken
可选。Optional. 用于取消此操作的 CancellationToken。A CancellationToken to cancel the operation.
返回
一个从存储的缓存键中获取字符串值的任务。A task that gets the string value from the stored cache key.