Skip to content

Commit

Permalink
Update README.md to show async unlocking
Browse files Browse the repository at this point in the history
  • Loading branch information
samcook committed Aug 26, 2021
1 parent 218feb4 commit 02995df
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ If you require more detailed configuration for the redis instances you are conne
var resource = "the-thing-we-are-locking-on";
var expiry = TimeSpan.FromSeconds(30);

using (var redLock = await redlockFactory.CreateLockAsync(resource, expiry)) // there are also non async Create() methods
await using (var redLock = await redlockFactory.CreateLockAsync(resource, expiry)) // there are also non async Create() methods
{
// make sure we got the lock
if (redLock.IsAcquired)
Expand All @@ -75,7 +75,7 @@ var wait = TimeSpan.FromSeconds(10);
var retry = TimeSpan.FromSeconds(1);

// blocks until acquired or 'wait' timeout
using (var redLock = await redlockFactory.CreateLockAsync(resource, expiry, wait, retry)) // there are also non async Create() methods
await using (var redLock = await redlockFactory.CreateLockAsync(resource, expiry, wait, retry)) // there are also non async Create() methods
{
// make sure we got the lock
if (redLock.IsAcquired)
Expand Down

0 comments on commit 02995df

Please sign in to comment.