Method ReadExclusiveAsync
ReadExclusiveAsync(TKey, ReadOptions, CancellationToken)
Retrieves and acquires an exclusive lock on an existing object in the cache.
public Task<CacheResponse<TKey, TValue>> ReadExclusiveAsync(TKey key, ReadOptions options = default, CancellationToken cancellationToken = default)
Parameters
key
TKeyIdentifier of the object in the cache.
options
ReadOptionsOptions that can be used when retrieving an object from the ScaleOut service.
cancellationToken
CancellationTokenA 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, the lock token, and the retrieved object (if successful).
Remarks
The Result property of the response will contain one of the following ServerResult outcomes:
ServerResult | Description |
---|---|
Retrieved | The object was successfully retrieved and locked in the ScaleOut service. |
NotFound | The requested object was not found in the ScaleOut service. |
Use the lock token on the response's LockToken property to perform subsequent operations under the lock.
Use the cancellationToken
parameter to control the amount of time the
caller should wait to acquire the exclusive lock.