...
string key
Shared lock key.
Returns
...
Remarks
This method immediately checks to shared key is locked and generates token if shared key is not locked. Does not perform any wait operation for availability, if you want to wait for short period, please use the Lock method instead.
Example
Code Block | ||
---|---|---|
| ||
$Cache.Set('myint', 4); var tokenValue = $Cache.TryLock('myintmylock'); if (tokenValue != null) { // Locked code block $Cache.ReleaseLock('myintmylock',tokenValue1); } else { // Already locked } |