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
keystringKey of the entry
revisionulongRevision to retrieve
serializerINatsDeserialize<T>Optional serialized to override the default
cancellationTokenCancellationTokenA CancellationToken used to cancel the API call.
Returns
- ValueTask<NatsResult<NatsKVEntry<T>>>
A NatsResult object representing the value or an error.
Type Parameters
TSerialized value type
Remarks
Use this method to avoid exceptions when, for example, the key is not found.