Rystem.Concurrency.Redis
6.0.7
See the version list below for details.
dotnet add package Rystem.Concurrency.Redis --version 6.0.7
NuGet\Install-Package Rystem.Concurrency.Redis -Version 6.0.7
<PackageReference Include="Rystem.Concurrency.Redis" Version="6.0.7" />
paket add Rystem.Concurrency.Redis --version 6.0.7
#r "nuget: Rystem.Concurrency.Redis, 6.0.7"
// Install Rystem.Concurrency.Redis as a Cake Addin #addin nuget:?package=Rystem.Concurrency.Redis&version=6.0.7 // Install Rystem.Concurrency.Redis as a Cake Tool #tool nuget:?package=Rystem.Concurrency.Redis&version=6.0.7
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.7)
- 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 | 28,593 | 11/16/2024 |
9.0.0-rc.1 | 74 | 10/18/2024 |
6.2.0 | 219,023 | 10/9/2024 |
6.1.1 | 92 | 10/9/2024 |
6.1.0 | 47,848 | 9/29/2024 |
6.0.24 | 103 | 9/11/2024 |
6.0.23 | 104 | 7/18/2024 |
6.0.21 | 111 | 6/18/2024 |
6.0.20 | 110 | 6/16/2024 |
6.0.19 | 108 | 6/14/2024 |
6.0.18 | 110 | 6/14/2024 |
6.0.17 | 114 | 6/14/2024 |
6.0.16 | 90 | 6/10/2024 |
6.0.15 | 97 | 6/9/2024 |
6.0.14 | 118 | 5/24/2024 |
6.0.13 | 107 | 5/23/2024 |
6.0.12 | 104 | 5/23/2024 |
6.0.11 | 114 | 5/20/2024 |
6.0.9 | 120 | 5/20/2024 |
6.0.7 | 113 | 5/18/2024 |
6.0.6 | 90 | 5/10/2024 |
6.0.5 | 95 | 5/10/2024 |
6.0.4 | 131 | 4/3/2024 |
6.0.3 | 1,196 | 3/25/2024 |