IBufferDistributedCache.SetAsync 方法

定义

异步设置或覆盖缓存项。

public System.Threading.Tasks.ValueTask SetAsync (string key, System.Buffers.ReadOnlySequence<byte> value, Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions options, System.Threading.CancellationToken token = default);
abstract member SetAsync : string * System.Buffers.ReadOnlySequence<byte> * Microsoft.Extensions.Caching.Distributed.DistributedCacheEntryOptions * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask
Public Function SetAsync (key As String, value As ReadOnlySequence(Of Byte), options As DistributedCacheEntryOptions, Optional token As CancellationToken = Nothing) As ValueTask

参数

key
String

要创建的条目的键。

value
ReadOnlySequence<Byte>

此缓存项的值。

options
DistributedCacheEntryOptions

值的缓存选项。

token
CancellationToken

用于传播操作应取消的通知的 CancellationToken

返回

注解

这在功能上类似于 SetAsync(String, Byte[], DistributedCacheEntryOptions, CancellationToken),但避免了数组分配。

适用于