Rystem.Concurrency.Redis 6.0.13

There is a newer version of this package available.
See the version list below for details.
dotnet add package Rystem.Concurrency.Redis --version 6.0.13
                    
NuGet\Install-Package Rystem.Concurrency.Redis -Version 6.0.13
                    
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.Redis" Version="6.0.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Rystem.Concurrency.Redis" Version="6.0.13" />
                    
Directory.Packages.props
<PackageReference Include="Rystem.Concurrency.Redis" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Rystem.Concurrency.Redis --version 6.0.13
                    
#r "nuget: Rystem.Concurrency.Redis, 6.0.13"
                    
#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.
#:package Rystem.Concurrency.Redis@6.0.13
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Rystem.Concurrency.Redis&version=6.0.13
                    
Install as a Cake Addin
#tool nuget:?package=Rystem.Concurrency.Redis&version=6.0.13
                    
Install as a Cake Tool

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.AddRedisLock(x =>
            {
                x.ConnectionString = configuration["ConnectionString:Redis"]!;
            });

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.AddRaceConditionWithRedis(x =>
            {
                x.ConnectionString = configuration["ConnectionString:Redis"]!;
            });

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.

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.  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.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
9.1.2 231,456 5/29/2025
9.1.1 97,802 5/2/2025
9.0.32 186,616 4/15/2025
9.0.31 5,688 4/2/2025
9.0.30 88,689 3/26/2025
9.0.29 8,910 3/18/2025
9.0.28 151 3/17/2025
9.0.27 143 3/16/2025
9.0.26 149 3/13/2025
9.0.25 52,008 3/9/2025
9.0.21 614 3/6/2025
9.0.20 19,500 3/6/2025
9.0.19 215 3/6/2025
9.0.18 212 3/4/2025
9.0.17 106 3/1/2025
9.0.16 106 3/1/2025
9.0.15 75,463 2/22/2025
9.0.14 22,472 2/18/2025
9.0.13 116 2/9/2025
9.0.12 217,887 1/13/2025
9.0.11 23,932 1/9/2025
9.0.10 58 1/9/2025
9.0.9 3,955 1/7/2025
9.0.8 12,450 1/6/2025
9.0.7 100 1/6/2025
9.0.4 92,239 12/23/2024
9.0.3 114 12/22/2024
9.0.2 10,657 12/21/2024
9.0.1 1,144 12/21/2024
9.0.0 172,951 11/16/2024
9.0.0-rc.1 97 10/18/2024
6.2.0 219,056 10/9/2024
6.1.1 116 10/9/2024
6.1.0 47,872 9/29/2024
6.0.24 126 9/11/2024
6.0.23 126 7/18/2024
6.0.21 131 6/18/2024
6.0.20 130 6/16/2024
6.0.19 134 6/14/2024
6.0.18 134 6/14/2024
6.0.17 136 6/14/2024
6.0.16 111 6/10/2024
6.0.15 116 6/9/2024
6.0.14 136 5/24/2024
6.0.13 128 5/23/2024
6.0.12 125 5/23/2024
6.0.11 140 5/20/2024
6.0.9 140 5/20/2024
6.0.7 132 5/18/2024
6.0.6 113 5/10/2024
6.0.5 118 5/10/2024
6.0.4 147 4/3/2024
6.0.3 1,468 3/25/2024