You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Factor to determine the clock drift. clock_drift = (lock_ttl_milliseconds * ClockDriveFactor) + 2. Adding 2 milliseconds to the drift to account for Redis expires precision (1 ms) plus the configured allowable drift factor. Read this for details.
0.01
Usage
varredlock= serviceProvider.GetRequiredService<IRedisLockManager>();varresource="resource_key";if(await redlock.LockAsync(resource, TimeSpan.FromSeconds(2))){try{// do stuffif(await redlock.IsLockedAsync(resource)){// do more stuffif(await redlock.ExtendLockAsync(resource, TimeSpan.FromSeconds(2))){// do even more stuff}else{// failed to extend resource lock// fallback}}else{// do something else}}finally{await redlock.UnlockAsync(resource);}}else{// failed to lock resource// fallback}