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
- keystring
- Key of the entry 
- revisionulong
- Revision to retrieve 
- serializerINatsDeserialize<T>
- Optional serialized to override the default 
- cancellationTokenCancellationToken
- 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.