Method TryUpdateAsync
- Namespace
- NATS.Client.KeyValueStore
- Assembly
- NATS.Client.KeyValueStore.dll
TryUpdateAsync<T>(string, T, ulong, INatsSerialize<T>?, CancellationToken)
Tries to update an entry in the bucket only if last update revision matches
public ValueTask<NatsResult<ulong>> TryUpdateAsync<T>(string key, T value, ulong revision, INatsSerialize<T>? serializer = null, CancellationToken cancellationToken = default)
Parameters
keystringKey of the entry
valueTValue of the entry
revisionulongLast revision number to match
serializerINatsSerialize<T>Serializer to use for the message type.
cancellationTokenCancellationTokenA CancellationToken used to cancel the API call.
Returns
- ValueTask<NatsResult<ulong>>
A NatsResult object representing the revision number of the updated entry or an error.
Type Parameters
TSerialized value type
Remarks
Use this method to avoid exceptions