TryLock¶
Attempts to acquire a lock for a shared key without blocking.
1 |
|
Parameters¶
string key
The shared lock key.
Returns¶
The token value as a string if the lock is acquired; otherwise, null.
Remarks¶
This method immediately checks whether the shared key is locked and generates a token if the shared key is not locked. It does not perform any wait operation for availability. If you want to wait for a short period, use the $Cache.Lock
method instead.
Example¶
1 2 3 4 5 6 7 |
|