AsyncKeyedLock 2.0.0

AsyncKeyedLock

An asynchronous .NET Standard 2.0 library that allows you to lock based on a key.

Installation

The recommended means is to use NuGet, but you could also download the source code from here.

Usage

var asyncKeyedLocker = new AsyncKeyedLocker();
using (var lockObj = await asyncKeyedLocker.LockAsync(myObject))
{
	...
}

You can also set the maximum number of requests for the semaphore that can be granted concurrently (set to 1 by default):

var asyncKeyedLocker = new AsyncKeyedLocker(2);

If you would like to see how many concurrent requests there are for a semaphore for a given key:

int myCount = asyncKeyedLocker.GetCount(myObject);

And if for some reason you need to force release the requests in the semaphore for a key:

asyncKeyedLocker.ForceRelease(myObject);

You may also use Dependency Injection to inject an instance of AsyncKeyedLock.

Credits

This library is based on Stephen Cleary's solution.

Showing the top 20 packages that depend on AsyncKeyedLock.

Packages Downloads
Volo.Abp.DistributedLocking.Abstractions
Package Description
2
Volo.Abp.DistributedLocking.Abstractions
Package Description
3
Volo.Abp.DistributedLocking.Abstractions
Package Description
4
Volo.Abp.DistributedLocking.Abstractions
Package Description
5

No longer static; now requires you to create an instance and store it, or inject it via dependency injection.

.NET Standard 2.0

  • No dependencies.

Version Downloads Last updated
6.4.2 3 05/29/2024
6.4.1 1 05/29/2024
6.4.0 1 05/29/2024
6.3.4 6 05/29/2024
6.3.4-rc 2 05/29/2024
6.3.4-beta 3 05/31/2024
6.3.3 1 05/29/2024
6.3.2 2 05/29/2024
6.3.0 4 05/29/2024
6.2.6 1 05/29/2024
6.2.5 4 05/29/2024
6.2.4 3 05/29/2024
6.2.3 1 05/29/2024
6.2.3-beta 3 05/31/2024
6.2.2 4 05/29/2024
6.2.1 3 05/29/2024
6.2.0 1 05/29/2024
6.1.1 1 05/29/2024
6.1.1-rc 1 05/29/2024
6.1.1-beta 2 05/31/2024
6.1.0 3 05/29/2024
6.0.5 3 05/29/2024
6.0.5-alpha 1 05/29/2024
6.0.4 3 05/29/2024
6.0.4-rc6 1 05/29/2024
6.0.4-rc5 1 05/29/2024
6.0.4-rc3 1 05/29/2024
6.0.4-rc 2 05/29/2024
6.0.4-beta 1 05/31/2024
6.0.4-alpha 1 05/29/2024
6.0.2 1 05/29/2024
6.0.1 2 05/29/2024
5.1.2 1 05/29/2024
5.1.1 1 05/29/2024
5.1.0 2 05/29/2024
5.0.4 4 05/29/2024
5.0.3 1 05/29/2024
5.0.3-rc 1 05/29/2024
5.0.2-rc 1 05/29/2024
4.0.2 2 05/29/2024
3.2.3 2 05/29/2024
3.2.1 3 05/29/2024
3.2.0 1 05/29/2024
3.0.1 3 05/29/2024
3.0.0 3 05/29/2024
2.0.3 2 05/29/2024
2.0.2 1 05/29/2024
2.0.1 1 05/29/2024
2.0.0 1 05/29/2024
1.1.0 1 05/29/2024
1.0.1 2 05/29/2024
1.0.0 2 05/29/2024