Table of Contents

Method RemoveOptimisticAsync

Namespace
Scaleout.Client
Assembly
Scaleout.Client.dll

RemoveOptimisticAsync(TKey, VersionToken, CancellationToken)

Removes an object from the cache using optimistic concurrency.

public Task<CacheResponse<TKey, TValue>> RemoveOptimisticAsync(TKey key, VersionToken version, CancellationToken cancellationToken = default)

Parameters

key TKey

Identifier of the object in the cache.

version VersionToken

The version of the object that the caller currently has and intends to remove.

cancellationToken CancellationToken

A token used to propagate notification that this operation should be canceled.

Returns

Task<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:

ServerResultDescription
RemovedThe object was successfully removed from the ScaleOut service.
NotFoundThe requested object was not found in the ScaleOut service.
VersionMismatchError The optimistic removal 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 removal.