Udostępnij za pośrednictwem


IBufferDistributedCache.TryGetAsync Method

Definition

Asynchronously attempts to retrieve an existing cache entry.

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)

Parameters

key
String

The unique key for the cache entry.

destination
IBufferWriter<Byte>

The target to write the cache contents on success.

token
CancellationToken

The CancellationToken used to propagate notifications that the operation should be canceled.

Returns

true if the cache entry is found, false otherwise.

Remarks

This method is functionally similar to GetAsync(String, CancellationToken), but avoids the array allocation.

Applies to