TryLockAsync¶
Asynchronously performs one immediate lock acquisition attempt.
1 | |
Parameters¶
string key
The shared lock key.
Returns¶
A promise containing the acquired token, or null when the key is already locked.
Remarks¶
This method does not wait for the lock to become available. Use $Cache.LockAsync when the script should wait for a limited time.
Performing work only when the lock is immediately available¶
1 2 3 4 5 6 7 8 9 10 11 | |
Skipping duplicate background work when another script has already started it¶
1 2 3 4 5 6 7 8 9 | |