AsyncKeyedLock 2.0.0
See the version list below for details.
dotnet add package AsyncKeyedLock --version 2.0.0
NuGet\Install-Package AsyncKeyedLock -Version 2.0.0
<PackageReference Include="AsyncKeyedLock" Version="2.0.0" />
<PackageVersion Include="AsyncKeyedLock" Version="2.0.0" />
<PackageReference Include="AsyncKeyedLock" />
paket add AsyncKeyedLock --version 2.0.0
#r "nuget: AsyncKeyedLock, 2.0.0"
#addin nuget:?package=AsyncKeyedLock&version=2.0.0
#tool nuget:?package=AsyncKeyedLock&version=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.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (42)
Showing the top 5 NuGet packages that depend on AsyncKeyedLock:
Package | 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! |
|
Volo.Abp.DistributedLocking.Abstractions
Package Description |
|
EFCoreSecondLevelCacheInterceptor
Entity Framework Core Second Level Caching Library. |
|
N3O.Umbraco.Extensions
TODO |
|
ZhileTime.Hope.DistributedLocking.Abstractions
Package Description |
GitHub repositories (14)
Showing the top 14 popular GitHub repositories that depend on AsyncKeyedLock:
Repository | Stars |
---|---|
jellyfin/jellyfin
The Free Software Media System - Server Backend & API
|
|
abpframework/abp
Open-source web application framework for ASP.NET Core! Offers an opinionated architecture to build enterprise software solutions with best practices on top of the .NET. Provides the fundamental infrastructure, cross-cutting-concern implementations, startup templates, application modules, UI themes, tooling and documentation.
|
|
Tyrrrz/DiscordChatExporter
Exports Discord chat logs to a file
|
|
microsoft/kiota
OpenAPI based HTTP Client code generator
|
|
stefanprodan/AspNetCoreRateLimit
ASP.NET Core rate limiting middleware
|
|
dotnetcore/EasyCaching
:boom: EasyCaching is an open source caching library that contains basic usages and some advanced usages of caching which can help us to handle caching more easier!
|
|
smartstore/Smartstore
A modular, scalable and ultra-fast open-source all-in-one eCommerce platform built on ASP.NET Core 7
|
|
VahidN/EFCoreSecondLevelCacheInterceptor
EF Core Second Level Cache Interceptor
|
|
omeryanar/FileExplorer
Windows File Explorer alternative with tab browsing
|
|
ForNeVeR/Cesium
C compiler for the CLI platform
|
|
ShokoAnime/Shokofin
Repository for Shokofin, a plugin that brings Shoko to Jellyfin.
|
|
vesoapp/veso
Open source media server.
|
|
VahidN/DNTCommon.Web.Core
DNTCommon.Web.Core provides common scenarios' solutions for ASP.NET Core applications.
|
|
sa-es-ir/DotNet.RateLimit
A Distributed RateLimit for Controller-Actions and Minimal API.
|
Version | Downloads | Last updated | |
---|---|---|---|
7.1.6 | 26,364 | 4/12/2025 | |
7.1.5-alpha | 93 | 4/12/2025 | |
7.1.4 | 454,437 | 11/22/2024 | |
7.1.4-preview | 110 | 11/22/2024 | |
7.1.3 | 157,990 | 11/10/2024 | |
7.0.2 | 146,228 | 10/13/2024 | |
7.0.1 | 588,495 | 8/20/2024 | |
7.0.0 | 115,725 | 7/21/2024 | |
7.0.0-rc3 | 144 | 7/20/2024 | |
7.0.0-rc2 | 141 | 7/20/2024 | |
7.0.0-rc1 | 171 | 6/29/2024 | |
7.0.0-beta | 146 | 6/29/2024 | |
7.0.0-alpha | 144 | 6/29/2024 | |
6.4.2 | 397,034 | 4/21/2024 | |
6.4.1 | 1,801 | 4/21/2024 | |
6.4.0 | 1,216 | 4/20/2024 | |
6.3.4 | 1,973,315 | 1/23/2024 | |
6.3.4-rc | 604 | 1/23/2024 | |
6.3.4-beta | 565 | 1/23/2024 | |
6.3.3 | 20,623 | 1/14/2024 | |
6.3.2 | 1,812 | 1/14/2024 | |
6.3.0 | 1,932 | 1/14/2024 | |
6.2.6 | 20,337 | 1/1/2024 | |
6.2.5 | 2,027 | 12/30/2023 | |
6.2.4 | 89,187 | 12/6/2023 | |
6.2.3 | 6,583 | 12/3/2023 | |
6.2.3-beta | 787 | 12/2/2023 | |
6.2.2 | 904,687 | 10/9/2023 | |
6.2.1 | 2,105,614 | 4/10/2023 | |
6.2.0 | 99,527 | 2/25/2023 | |
6.1.1 | 65,173 | 1/27/2023 | |
6.1.1-rc | 1,135 | 1/27/2023 | |
6.1.1-beta | 1,099 | 1/27/2023 | |
6.1.0 | 18,545 | 1/26/2023 | |
6.0.5 | 47,187 | 1/2/2023 | |
6.0.5-alpha | 1,127 | 12/30/2022 | |
6.0.4 | 3,132 | 12/30/2022 | |
6.0.4-rc6 | 1,097 | 12/30/2022 | |
6.0.4-rc5 | 1,133 | 12/30/2022 | |
6.0.4-rc3 | 1,103 | 12/30/2022 | |
6.0.4-rc | 1,067 | 12/29/2022 | |
6.0.4-beta | 1,137 | 12/29/2022 | |
6.0.4-alpha | 1,168 | 12/29/2022 | |
6.0.3 | 3,643 | 12/29/2022 | |
6.0.2 | 30,274 | 12/18/2022 | |
6.0.1 | 3,045 | 12/17/2022 | |
5.1.2 | 4,126 | 12/16/2022 | |
5.1.1 | 12,120 | 12/13/2022 | |
5.1.0 | 4,977 | 12/3/2022 | |
5.0.4 | 11,226 | 11/27/2022 | |
5.0.3 | 3,556 | 11/26/2022 | |
5.0.3-rc | 1,138 | 11/26/2022 | |
5.0.2-rc | 1,095 | 11/26/2022 | |
5.0.1 | 4,042 | 11/19/2022 | |
4.0.2 | 8,313 | 11/13/2022 | |
3.2.3 | 4,386 | 10/26/2022 | |
3.2.1 | 3,385 | 10/23/2022 | |
3.2.0 | 3,055 | 10/23/2022 | |
3.0.1 | 3,580 | 10/18/2022 | |
3.0.0 | 3,366 | 10/16/2022 | |
2.0.3 | 17,512 | 6/29/2022 | |
2.0.2 | 18,384 | 3/13/2022 | |
2.0.1 | 3,468 | 3/13/2022 | |
2.0.0 | 3,548 | 3/11/2022 | |
1.1.0 | 4,738 | 12/11/2021 | |
1.0.1 | 3,510 | 11/22/2021 | |
1.0.0 | 3,699 | 11/22/2021 |
No longer static; now requires you to create an instance and store it, or inject it via dependency injection.