Locks the cached object to prevent other clients from updating or removing it and returns the object corresponding to the key.
Namespace: Soss.Compat.WSAFAssembly: soss_wsaf_compat (in soss_wsaf_compat.dll) Version: 1.1.0.100 (1.1.0.100)
public Object GetAndLock(
string key,
out DataCacheLockHandle lockHandle
)
Public Function GetAndLock (
key As String,
<OutAttribute> ByRef lockHandle As DataCacheLockHandle
) As Object
public:
Object^ GetAndLock(
String^ key,
[OutAttribute] DataCacheLockHandle^% lockHandle
)
member GetAndLock :
key : string *
lockHandle : DataCacheLockHandle byref -> Object
Parameters
- key
- Type: SystemString
The unique identifier used to access the object in the cache. - lockHandle
- Type: Soss.Compat.WSAFDataCacheLockHandle
The DataCacheLockHandle object required to unlock the object (output parameter).
Return Value
Type:
ObjectThe object in the cache that was stored in the cache with the specified
key.
If the key does not exist, a DataCacheException is thrown with the ErrorCode set to
KeyDoesNotExist.
If the object is already locked by another client, a DataCacheException
is thrown with the ErrorCode set to ObjectLocked.
Other clients calling GetAndLock on the same object while it is locked will fail as long as the lock remains valid. ScaleOut StateServer
does not lock object for all client accesses - it allows the clients that do not use locking to get or update objects,
but it prevents the object from being updated from the clients that use locking explicitly for their operations with objects.
If the lock is not explicitly released by the client that originally obtained the lock, the object lock will automatically expire after 90 seconds
(this lock expiration interval is configurable in the ScaleOut StateServer service).
Reference