Method UpdateOptimistic
UpdateOptimistic(TKey, TValue, VersionToken, UpdatePolicy, IEnumerable<string>, CancellationToken)
Updates an existing object in the cache using optimistic concurrency.
public CacheResponse<TKey, TValue> UpdateOptimistic(TKey key, TValue value, VersionToken version, UpdatePolicy updatePolicy = null, IEnumerable<string> tags = null, CancellationToken cancellationToken = default)
Parameters
key
TKeyIdentifier of the object in the cache.
value
TValueValue to be stored in the cache.
version
VersionTokenThe version of the object that the caller currently has and intends to update.
updatePolicy
UpdatePolicyPolicy changes to make to the object in the ScaleOut service. If null, the policy is left unchanged.
tags
IEnumerable<string>Collection of tags to associate with the object. All tags are replaced with the provided collection. Pass null to leave current tags in place. An empty collection clears current tags.
cancellationToken
CancellationTokenA token used to propagate notification that this operation should be canceled.
Returns
- CacheResponse<TKey, TValue>
A CacheResponse<TKey, TValue> containing the outcome of the operation.
Remarks
The Result property of the response will contain one of the following ServerResult outcomes:
ServerResult | Description |
---|---|
Updated | The object was successfully updated in the ScaleOut service. |
NotFound | The requested object was not found in the ScaleOut service. |
VersionMismatchError |
The optimistic update could not be performed because the supplied
version did not match the latest version of the object in the
ScaleOut service. The object should be re-retrieved to get its latest
version prior to retrying the optimistic update.
|