Table of Contents

Method TryGetEntryAsync

Namespace
NATS.Client.KeyValueStore
Assembly
NATS.Client.KeyValueStore.dll

TryGetEntryAsync<T>(string, ulong, INatsDeserialize<T>?, CancellationToken)

Try to get an entry from the bucket using the key.

ValueTask<NatsResult<NatsKVEntry<T>>> TryGetEntryAsync<T>(string key, ulong revision = 0, INatsDeserialize<T>? serializer = null, CancellationToken cancellationToken = default)

Parameters

key string

Key of the entry

revision ulong

Revision to retrieve

serializer INatsDeserialize<T>

Optional serialized to override the default

cancellationToken CancellationToken

A CancellationToken used to cancel the API call.

Returns

ValueTask<NatsResult<NatsKVEntry<T>>>

A NatsResult object representing the value or an error.

Type Parameters

T

Serialized value type

Remarks

Use this method to avoid exceptions when, for example, the key is not found.