AsyncKeyedLock 6.2.0

AsyncKeyedLock AsyncKeyedLock

GitHub Workflow Status NuGet NuGet Codacy Grade

An asynchronous .NET Standard 2.0 library that allows you to lock based on a key (keyed semaphores), limiting concurrent threads sharing the same key to a specified number, with optional pooling for reducing memory allocations.

For example, suppose you were processing financial transactions, but while working on one account you wouldn't want to concurrently process a transaction for the same account. Of course, you could just add a normal lock, but then you can only process one transaction at a time. If you're processing a transaction for account A, you may want to also be processing a separate transaction for account B. That's where AsyncKeyedLock comes in: it allows you to lock but only if the key matches.

The library uses two very different methods for locking, one using an underlying ConcurrentDictionary that's cleaned up after use whilst the other using a technique called striped locking. Both have their advantages and disadvantages, and in order to help you choose you are highly recommended to read about it in the wiki.

Installation and usage

The documentation can be found in our wiki.

Credits

Check out our list of contributors!

Showing the top 20 packages that depend on AsyncKeyedLock.

Created an alternate method for locking using striped locks. For a list of pros and cons of both techniques, please visit the wiki at https://github.com/MarkCiliaVincenti/AsyncKeyedLock/wiki

.NET 5.0

  • No dependencies.

.NET Standard 2.0

.NET Standard 2.1

  • No dependencies.

Version Downloads Last updated
7.1.8 4 12/08/2025
7.1.8-beta5 3 12/08/2025
7.1.8-beta4 3 12/08/2025
7.1.8-beta3 3 12/08/2025
7.1.8-beta2 3 12/08/2025
7.1.8-beta 3 12/08/2025
7.1.7 7 10/07/2025
7.1.6 21 05/09/2025
7.1.5-alpha 15 05/09/2025
7.1.4 18 03/03/2025
7.1.4-preview 18 03/03/2025
7.1.3 20 03/03/2025
7.0.2 17 03/03/2025
7.0.1 17 03/03/2025
7.0.0 18 03/03/2025
7.0.0-rc3 17 03/03/2025
7.0.0-rc2 17 03/03/2025
7.0.0-rc1 17 03/03/2025
7.0.0-beta 18 03/03/2025
7.0.0-alpha 18 03/03/2025
6.4.2 22 04/30/2024
6.4.1 18 04/30/2024
6.4.0 18 04/30/2024
6.3.4 48 02/21/2024
6.3.4-rc 20 02/21/2024
6.3.4-beta 23 02/21/2024
6.3.3 23 02/21/2024
6.3.2 20 02/21/2024
6.3.0 20 02/21/2024
6.2.6 20 02/21/2024
6.2.5 20 02/21/2024
6.2.4 23 02/21/2024
6.2.3 22 02/21/2024
6.2.3-beta 22 02/21/2024
6.2.2 19 02/21/2024
6.2.1 158 01/21/2024
6.2.0 23 02/21/2024
6.1.1 21 02/21/2024
6.1.1-rc 21 02/21/2024
6.1.1-beta 21 02/21/2024
6.1.0 21 02/21/2024
6.0.5 20 02/21/2024
6.0.5-alpha 21 02/20/2024
6.0.4 20 02/21/2024
6.0.4-rc6 20 02/21/2024
6.0.4-rc5 20 02/21/2024
6.0.4-rc3 21 02/21/2024
6.0.4-rc 21 02/21/2024
6.0.4-beta 21 02/21/2024
6.0.4-alpha 22 02/20/2024
6.0.3 20 02/21/2024
6.0.2 20 02/21/2024
6.0.1 21 02/21/2024
5.1.2 22 02/21/2024
5.1.1 21 02/21/2024
5.1.0 21 02/21/2024
5.0.4 19 02/21/2024
5.0.3 20 02/21/2024
5.0.3-rc 20 02/21/2024
5.0.2-rc 20 02/21/2024
5.0.1 22 02/21/2024
4.0.2 19 02/21/2024
3.2.3 20 02/21/2024
3.2.1 21 02/21/2024
3.2.0 19 02/21/2024
3.0.1 21 02/21/2024
3.0.0 21 02/21/2024
2.0.3 21 02/21/2024
2.0.2 21 02/21/2024
2.0.1 21 02/21/2024
2.0.0 20 02/21/2024
1.1.0 21 02/21/2024
1.0.1 20 02/21/2024
1.0.0 22 02/21/2024