Rystem.Concurrency 6.2.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package Rystem.Concurrency --version 6.2.0                
NuGet\Install-Package Rystem.Concurrency -Version 6.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Rystem.Concurrency" Version="6.2.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Rystem.Concurrency --version 6.2.0                
#r "nuget: Rystem.Concurrency, 6.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Rystem.Concurrency as a Cake Addin
#addin nuget:?package=Rystem.Concurrency&version=6.2.0

// Install Rystem.Concurrency as a Cake Tool
#tool nuget:?package=Rystem.Concurrency&version=6.2.0                

What is Rystem?

Concurrency

Async Lock

A lock keyword is used in C# to lock a memory address to have a sort of execution queue. But, unfortunately, you cannot use async methods in the lock statement. With async lock you also may have the lock behavior for your async methods. In DI you have to add the lock service

services.AddLock();

Inject ILock and use it

ILock locking = _serviceProvider.CreateScope().ServiceProvider.GetService<ILock>();
await locking!.ExecuteAsync(() => CountAsync(2), "SampleKey");

You have the method to execute, a key for more than one concurrent lock.

Race condition

First of all, you have to understand the race condition here In DI you have to add the lock service

services.AddRaceCondition();

Inject IRaceCodition and use it

 var raceCondition = _serviceProvider.CreateScope().ServiceProvider.GetService<IRaceCodition>();
 raceCondition!.ExecuteAsync(() => CountAsync(2), (i % 2).ToString(), TimeSpan.FromSeconds(2));

You have the method to execute, a key for more than one concurrent race, and a time span for time window, if you put 2 seconds, you block the execution of further methods for 2 seconds from when first method started.

ILockable

You can inject the ILockable interface for your purpose, like a distributed lock with Blob storage, or redis cache for instance.

services.AddLockableIntegration<BlobLockIntegration>();
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Rystem.Concurrency:

Package Downloads
Rystem.Test.XUnit

Rystem is a open-source framework to improve the System namespace in .Net

Rystem.BackgroundJob

Rystem.

Rystem.Concurrency.Redis

Rystem.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
9.0.3 47 12/22/2024
9.0.2 5,992 12/21/2024
9.0.1 1,093 12/21/2024
9.0.0 172,969 11/16/2024
9.0.0-rc.1 96 10/18/2024
6.2.0 219,064 10/9/2024
6.1.1 135 10/9/2024
6.1.0 47,912 9/29/2024
6.0.24 187 9/11/2024
6.0.23 340,066 7/18/2024
6.0.21 165 6/18/2024
6.0.20 727,817 6/16/2024
6.0.19 30,399 6/14/2024
6.0.18 150 6/14/2024
6.0.17 160 6/14/2024
6.0.16 49,986 6/10/2024
6.0.15 162 6/9/2024
6.0.14 170 5/24/2024
6.0.13 151 5/23/2024
6.0.12 139 5/23/2024
6.0.11 150 5/20/2024
6.0.9 148 5/19/2024
6.0.7 130 5/18/2024
6.0.6 153 5/10/2024
6.0.5 153 5/10/2024
6.0.4 175 4/3/2024
6.0.3 1,463 3/25/2024
6.0.2 2,513 3/11/2024
6.0.1 138 3/8/2024
6.0.0 382 11/21/2023
6.0.0-rc.6 113 10/25/2023
6.0.0-rc.5 81 10/25/2023
6.0.0-rc.4 77 10/23/2023
6.0.0-rc.3 73 10/19/2023
6.0.0-rc.2 84 10/18/2023
6.0.0-rc.1 85 10/16/2023
5.0.20 538 9/25/2023
5.0.19 1,120 9/10/2023
5.0.18 368 9/6/2023
5.0.17 349 9/6/2023
5.0.16 326 9/5/2023
5.0.15 339 9/5/2023
5.0.14 347 9/5/2023
5.0.13 458 9/1/2023
5.0.12 320 8/31/2023
5.0.11 349 8/30/2023
5.0.10 351 8/29/2023
5.0.9 341 8/24/2023
5.0.8 342 8/24/2023
5.0.7 337 8/23/2023
5.0.6 338 8/21/2023
5.0.5 357 8/21/2023
5.0.4 367 8/16/2023
5.0.3 424 8/2/2023
5.0.2 376 8/2/2023
5.0.1 412 8/1/2023
5.0.0 406 7/31/2023
4.1.26 731 7/20/2023
4.1.25 385 7/16/2023
4.1.24 591 6/13/2023
4.1.23 403 6/13/2023
4.1.22 401 5/30/2023
4.1.21 412 5/20/2023
4.1.20 315,609 4/19/2023
4.1.19 95,196 3/20/2023
4.1.18 484 3/20/2023
4.1.17 483 3/16/2023
4.1.16 508 3/16/2023
4.1.15 946 3/15/2023
4.1.14 2,184 3/9/2023
4.1.13 508 3/7/2023
4.1.12 548 2/9/2023
4.1.11 555 1/26/2023
4.1.10 561 1/22/2023
4.1.9 570 1/20/2023
4.1.8 570 1/18/2023
4.1.7 595 1/18/2023
4.1.6 557 1/17/2023
4.1.1 542 1/4/2023
4.1.0 557 12/30/2022
3.0.25 738 12/21/2022
3.0.24 800 11/18/2022
3.0.23 773 11/18/2022
3.0.22 818 11/15/2022
3.0.21 806 11/14/2022
3.0.20 774 11/13/2022
3.0.19 814 11/2/2022
3.0.18 837 11/2/2022
3.0.17 854 10/29/2022
3.0.16 857 10/29/2022
3.0.15 869 10/29/2022
2.0.6 919 9/20/2022
2.0.5 1,177 9/20/2022
2.0.4 922 9/20/2022
2.0.3 494 9/20/2022
2.0.1 1,003 9/13/2022
2.0.0 835 8/19/2022
1.1.24 1,078 7/30/2022
1.1.23 938 7/29/2022
1.1.22 482 7/29/2022
1.1.21 914 7/29/2022
1.1.20 949 7/29/2022
1.1.19 985 7/27/2022
1.1.17 939 7/27/2022
1.1.16 500 7/26/2022
1.1.15 949 7/25/2022
1.1.14 951 7/25/2022
1.1.13 941 7/22/2022
1.1.12 938 7/19/2022
1.1.11 971 7/19/2022
1.1.10 957 7/19/2022
1.1.9 965 7/19/2022
1.1.8 960 7/18/2022
1.1.7 974 7/18/2022
1.1.6 957 7/18/2022
1.0.5 520 7/17/2022
1.0.4 952 7/17/2022
1.0.2 1,005 7/17/2022
1.0.1 482 7/12/2022
1.0.0 1,533 7/8/2022
0.10.7 1,025 7/8/2022
0.9.12 962 6/30/2022
0.9.11 925 6/29/2022
0.9.10 987 6/28/2022
0.9.9 509 6/27/2022