MemoryDistributedCache.SetAsync 方法
定义
重载
| SetAsync(String, Byte[], DistributedCacheEntryOptions) | |
| SetAsync(String, Byte[], DistributedCacheEntryOptions, CancellationToken) |
设置具有给定键的值。Sets the value with the given key. |
SetAsync(String, Byte[], DistributedCacheEntryOptions)
public:
virtual System::Threading::Tasks::Task ^ SetAsync(System::String ^ key, cli::array <System::Byte> ^ value, Microsoft::Extensions::Caching::Distributed::DistributedCacheEntryOptions ^ options);
public System.Threading.Tasks.Task SetAsync (string key, byte[] value, Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions options);
abstract member SetAsync : string * byte[] * Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions -> System.Threading.Tasks.Task
override this.SetAsync : string * byte[] * Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions -> System.Threading.Tasks.Task
Public Function SetAsync (key As String, value As Byte(), options As DistributedCacheEntryOptions) As Task
参数
- key
- String
- value
- Byte[]
- options
- DistributedCacheEntryOptions
返回
实现
适用于
SetAsync(String, Byte[], DistributedCacheEntryOptions, CancellationToken)
设置具有给定键的值。Sets the value with the given key.
public System.Threading.Tasks.Task SetAsync (string key, byte[] value, Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions options, System.Threading.CancellationToken token = default);
abstract member SetAsync : string * byte[] * Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
override this.SetAsync : string * byte[] * Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions * System.Threading.CancellationToken -> System.Threading.Tasks.Task
Public Function SetAsync (key As String, value As Byte(), options As DistributedCacheEntryOptions, Optional token As CancellationToken = Nothing) As Task
参数
- key
- String
用于标识所请求的值的字符串。A string identifying the requested value.
- value
- Byte[]
要在缓存中设置的值。The value to set in the cache.
- options
- DistributedCacheEntryOptions
值的缓存选项。The cache options for the value.
- token
- CancellationToken
可选。Optional. CancellationToken,用于传播应取消操作的通知。The CancellationToken used to propagate notifications that the operation should be canceled.
返回
表示异步操作的 Task。The Task that represents the asynchronous operation.