IBufferDistributedCache.TryGetAsync 方法

定义

异步尝试检索现有缓存项。

public System.Threading.Tasks.ValueTask<bool> TryGetAsync(string key, System.Buffers.IBufferWriter<byte> destination, System.Threading.CancellationToken token = default);
abstract member TryGetAsync : string * System.Buffers.IBufferWriter<byte> * System.Threading.CancellationToken -> System.Threading.Tasks.ValueTask<bool>
Public Function TryGetAsync (key As String, destination As IBufferWriter(Of Byte), Optional token As CancellationToken = Nothing) As ValueTask(Of Boolean)

参数

key
String

缓存项的唯一键。

destination
IBufferWriter<Byte>

成功时写入缓存内容的目标。

token
CancellationToken

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

返回

如果找到缓存条目,则为 /a0;否则。

注解

此方法在功能上类似于 GetAsync(String, CancellationToken),但会避免数组分配。

适用于