ReactiveLock.Distributed.Redis
0.0.13
See the version list below for details.
dotnet add package ReactiveLock.Distributed.Redis --version 0.0.13
NuGet\Install-Package ReactiveLock.Distributed.Redis -Version 0.0.13
<PackageReference Include="ReactiveLock.Distributed.Redis" Version="0.0.13" />
<PackageVersion Include="ReactiveLock.Distributed.Redis" Version="0.0.13" />
<PackageReference Include="ReactiveLock.Distributed.Redis" />
paket add ReactiveLock.Distributed.Redis --version 0.0.13
#r "nuget: ReactiveLock.Distributed.Redis, 0.0.13"
#:package ReactiveLock.Distributed.Redis@0.0.13
#addin nuget:?package=ReactiveLock.Distributed.Redis&version=0.0.13
#tool nuget:?package=ReactiveLock.Distributed.Redis&version=0.0.13
ReactiveLock
ReactiveLock is a .NET 9 library for reactive, distributed lock coordination. It lets multiple application instances track “busy”/“idle” state and react to changes via async handlers. Redis is provided out-of-the-box, but you can plug in any backend.
Packages
ReactiveLock.Core
Core abstractions and in‑process state management. You can use it if no distributed strategy is needed.ReactiveLock.Distributed.Redis
Redis‑backed distributed implementation ofReactiveLock.Core
.ReactiveLock.DependencyInjection
Dependency Injection extensions for controller, state, and factory services with keyed resolution support forReactiveLock.Distributed.*
libs..
Concepts
Tracker Controller (
IReactiveLockTrackerController
)
CallIncrementAsync()
/DecrementAsync()
to mark this instance busy or idle.Tracker State (
IReactiveLockTrackerState
)
CallIsBlockedAsync()
orWaitIfBlockedAsync()
to observe or wait for global idle state.Store (
IReactiveLockTrackerStore
)
Persists and propagates instance states. Redis store is included; custom stores are supported.
Installation
dotnet add package ReactiveLock.Core
dotnet add package ReactiveLock.DependencyInjection
dotnet add package ReactiveLock.Distributed.Redis
Registration
In Program.cs
(or equivalent):
// 1. Register factory and Redis connection
builder.Services.InitializeDistributedRedisReactiveLock("instance-id");
builder.Services.AddSingleton<IConnectionMultiplexer>(
ConnectionMultiplexer.Connect("localhost:6379"));
// 2. Register one or more locks
builder.Services.AddDistributedRedisReactiveLock(
lockKey: "my-lock",
onLockedHandlers: [ sp => Task.CompletedTask ],
onUnlockedHandlers: [ sp => Task.CompletedTask ]);
// 3. After Build(), start subscription loop
var app = builder.Build();
await app.UseDistributedRedisReactiveLockAsync();
Usage
var factory = app.Services.GetRequiredService<IReactiveLockTrackerFactory>();
var controller = factory.GetTrackerController("my-lock");
var state = factory.GetTrackerState("my-lock");
// Mark busy
await controller.IncrementAsync();
// … work …
await controller.DecrementAsync();
// React to global state
if (await state.IsBlockedAsync())
/* handle blocked */;
await state.WaitIfBlockedAsync();
Requirements
- .NET 9
License
MIT © Michel Oliveira
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. 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. |
-
net9.0
- Microsoft.AspNetCore.Http.Abstractions (>= 2.3.0)
- StackExchange.Redis (>= 2.8.58)
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 |
---|---|---|
0.0.22-beta.5 | 6 | 8/11/2025 |
0.0.22-beta.4 | 23 | 8/10/2025 |
0.0.22-beta.3 | 16 | 8/10/2025 |
0.0.22-beta.2 | 50 | 8/9/2025 |
0.0.22-beta.1 | 49 | 8/9/2025 |
0.0.21 | 770 | 7/30/2025 |
0.0.20 | 93 | 7/30/2025 |
0.0.19 | 115 | 7/29/2025 |
0.0.17 | 93 | 7/29/2025 |
0.0.16 | 86 | 7/29/2025 |
0.0.15 | 173 | 7/26/2025 |
0.0.13 | 140 | 7/26/2025 |
0.0.12 | 204 | 7/26/2025 |
0.0.11 | 276 | 7/25/2025 |
0.0.9 | 280 | 7/25/2025 |
0.0.8 | 295 | 7/25/2025 |
0.0.7 | 298 | 7/25/2025 |
0.0.6 | 305 | 7/25/2025 |
0.0.5 | 322 | 7/25/2025 |
0.0.4 | 322 | 7/25/2025 |
0.0.3 | 319 | 7/25/2025 |
0.0.2 | 328 | 7/25/2025 |
0.0.1 | 326 | 7/25/2025 |