Asynchronously locks the cached object in SOSS to prevent other clients from updating or removing it. This extension method is simply a convenience wrapper for AcquireLockAsync(CachedObjectId, LockTicket, CancellationToken) that creates a CachedObjectId from id.
Assembly: soss_namedcache (in soss_namedcache.dll) Version: 126.96.36.199
public static Task<LockTicket> AcquireLockAsync( this NamedCache cache, Guid id, LockTicket lockTicket = null, CancellationToken cancellationToken = null )
<ExtensionAttribute> Public Shared Function AcquireLockAsync ( cache As NamedCache, id As Guid, Optional lockTicket As LockTicket = Nothing, Optional cancellationToken As CancellationToken = Nothing ) As Task(Of LockTicket)
- Type: Soss.ClientNamedCache
the NamedCache this extension method operates on.
- Type: SystemGuid
a Guid that will be transformed into a CachedObjectId via CreateKey(Guid) which identifies the object in the cache.
- lockTicket (Optional)
- Type: Soss.ClientLockTicket
If specified, the expected LockTicket corresponding to the locked object
- cancellationToken (Optional)
- Type: System.ThreadingCancellationToken
An optional CancellationToken that can be used to cancel the asynchronous operation.
Return ValueType: TaskLockTicket
A TaskTResult. The LockTicket can be supplied to other asynchronous API methods to indicate that the caller expects the object to be locked with the given LockTicket.
Usage NoteIn Visual Basic and C#, you can call this method as an instance method on any object of type NamedCache. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
|NotSupportedException||Thrown when unexpected status is returned from the cache.|
|ReadThroughTimeoutException||Thrown if backing store read-through or GeoServer pull replication is used with this NamedCache and the retrieval of the object is delayed beyond the number of retries specified by MaxReadThroughPendingAttempts.|
|ObjectLockedException||Unable to acquire lock while retrieving object.|