Rystem.Concurrency.Redis
6.0.13
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
<PackageReference Include="Rystem.Concurrency.Redis" Version="6.0.13" />
paket add Rystem.Concurrency.Redis --version 6.0.13
#r "nuget: Rystem.Concurrency.Redis, 6.0.13"
// Install Rystem.Concurrency.Redis as a Cake Addin #addin nuget:?package=Rystem.Concurrency.Redis&version=6.0.13 // Install Rystem.Concurrency.Redis as a Cake Tool #tool nuget:?package=Rystem.Concurrency.Redis&version=6.0.13
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 | Versions 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. |
-
net8.0
- Rystem.Concurrency (>= 6.0.13)
- StackExchange.Redis (>= 2.7.33)
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.0.0 | 147,417 | 11/16/2024 |
9.0.0-rc.1 | 75 | 10/18/2024 |
6.2.0 | 219,030 | 10/9/2024 |
6.1.1 | 97 | 10/9/2024 |
6.1.0 | 47,855 | 9/29/2024 |
6.0.24 | 108 | 9/11/2024 |
6.0.23 | 109 | 7/18/2024 |
6.0.21 | 116 | 6/18/2024 |
6.0.20 | 115 | 6/16/2024 |
6.0.19 | 120 | 6/14/2024 |
6.0.18 | 115 | 6/14/2024 |
6.0.17 | 119 | 6/14/2024 |
6.0.16 | 97 | 6/10/2024 |
6.0.15 | 102 | 6/9/2024 |
6.0.14 | 123 | 5/24/2024 |
6.0.13 | 114 | 5/23/2024 |
6.0.12 | 111 | 5/23/2024 |
6.0.11 | 119 | 5/20/2024 |
6.0.9 | 125 | 5/20/2024 |
6.0.7 | 118 | 5/18/2024 |
6.0.6 | 95 | 5/10/2024 |
6.0.5 | 100 | 5/10/2024 |
6.0.4 | 134 | 4/3/2024 |
6.0.3 | 1,310 | 3/25/2024 |