IBufferDistributedCache.TryGetAsync Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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.