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
EasyCaching.Core
EasyCaching is a open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
35
EasyCaching.Core
EasyCaching is a open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
36
EasyCaching.Core
EasyCaching is a open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
37
EasyCaching.Core
EasyCaching is a open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
38
EasyCaching.Core
EasyCaching is a open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
40
EasyCaching.Core
EasyCaching is a open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
43
EasyCaching.Core
EasyCaching is a open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
44
EasyCaching.Core
EasyCaching is a open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
45
Volo.Abp.DistributedLocking.Abstractions
Package Description
35
Volo.Abp.DistributedLocking.Abstractions
Package Description
36
Volo.Abp.DistributedLocking.Abstractions
Package Description
37
Volo.Abp.DistributedLocking.Abstractions
Package Description
39
Volo.Abp.DistributedLocking.Abstractions
Package Description
41
Volo.Abp.DistributedLocking.Abstractions
Package Description
43
Volo.Abp.DistributedLocking.Abstractions
Package Description
45

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
7.1.8 16 11/27/2025
7.1.8-beta5 13 11/25/2025
7.1.8-beta4 13 11/26/2025
7.1.8-beta3 14 11/25/2025
7.1.8-beta2 16 11/26/2025
7.1.8-beta 14 11/26/2025
7.1.7 20 10/06/2025
7.1.6 31 04/14/2025
7.1.5-alpha 23 04/14/2025
7.1.4 34 12/02/2024
7.1.4-preview 30 11/30/2024
7.1.3 31 11/19/2024
7.0.2 36 11/25/2024
7.0.1 32 11/28/2024
7.0.0 33 11/21/2024
7.0.0-rc3 29 11/25/2024
7.0.0-rc2 32 11/28/2024
7.0.0-rc1 31 11/30/2024
7.0.0-beta 26 01/01/2025
7.0.0-alpha 35 11/25/2024
6.4.2 34 05/29/2024
6.4.1 37 05/29/2024
6.4.0 37 05/29/2024
6.3.4 45 05/29/2024
6.3.4-rc 39 05/29/2024
6.3.4-beta 32 05/31/2024
6.3.3 36 05/29/2024
6.3.2 35 05/29/2024
6.3.0 43 05/29/2024
6.2.6 31 05/29/2024
6.2.5 38 05/29/2024
6.2.4 39 05/29/2024
6.2.3 35 05/29/2024
6.2.3-beta 38 05/31/2024
6.2.2 39 05/29/2024
6.2.1 36 05/29/2024
6.2.0 36 05/29/2024
6.1.1 38 05/29/2024
6.1.1-rc 35 05/29/2024
6.1.1-beta 37 05/31/2024
6.1.0 40 05/29/2024
6.0.5 42 05/29/2024
6.0.5-alpha 33 05/29/2024
6.0.4 36 05/29/2024
6.0.4-rc6 34 05/29/2024
6.0.4-rc5 35 05/29/2024
6.0.4-rc3 31 05/29/2024
6.0.4-rc 34 05/29/2024
6.0.4-beta 31 05/31/2024
6.0.4-alpha 35 05/29/2024
6.0.3 37 11/28/2024
6.0.2 33 05/29/2024
6.0.1 36 05/29/2024
5.1.2 34 05/29/2024
5.1.1 39 05/29/2024
5.1.0 37 05/29/2024
5.0.4 35 05/29/2024
5.0.3 39 05/29/2024
5.0.3-rc 36 05/29/2024
5.0.2-rc 36 05/29/2024
5.0.1 32 11/27/2024
4.0.2 37 05/29/2024
3.2.3 36 05/29/2024
3.2.1 38 05/29/2024
3.2.0 40 05/29/2024
3.0.1 42 05/29/2024
3.0.0 39 05/29/2024
2.0.3 34 05/29/2024
2.0.2 39 05/29/2024
2.0.1 38 05/29/2024
2.0.0 36 05/29/2024
1.1.0 39 05/29/2024
1.0.1 40 05/29/2024
1.0.0 37 05/29/2024