Table of Contents

Method ReadLocked

Namespace
Scaleout.Client
Assembly
Scaleout.Client.dll

ReadLocked(TKey, LockToken, ReadOptions, CancellationToken)

Retrieves an existing object in the cache that is already locked by the caller, retaining the lock for subsequent locking operations.

public CacheResponse<TKey, TValue> ReadLocked(TKey key, LockToken lockToken, ReadOptions options = default, CancellationToken cancellationToken = default)

Parameters

key TKey

Identifier of the object in the cache.

lockToken LockToken

A non-empty lock token that was acquired from an earlier locking call.

options ReadOptions

Options that can be used when retrieving an object from the ScaleOut service.

cancellationToken CancellationToken

A 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, the lock token, and the retrieved object (if successful).

Remarks

The Result property of the response will contain one of the following ServerResult outcomes:

ServerResultDescription
Retrieved The object was successfully retrieved from the ScaleOut service, and the exclusive lock was refreshed.
NotFoundThe requested object was not found in the ScaleOut service.
LockLostError The exclusive lock on the object was lost (typically due to a lock timeout) and another caller claimed it.

Use the lock token on the response's LockToken property to perform subsequent operations under the lock.