ReactiveLock.DependencyInjection
0.0.13
Prefix Reserved
See the version list below for details.
dotnet add package ReactiveLock.DependencyInjection --version 0.0.13
NuGet\Install-Package ReactiveLock.DependencyInjection -Version 0.0.13
<PackageReference Include="ReactiveLock.DependencyInjection" Version="0.0.13" />
<PackageVersion Include="ReactiveLock.DependencyInjection" Version="0.0.13" />
<PackageReference Include="ReactiveLock.DependencyInjection" />
paket add ReactiveLock.DependencyInjection --version 0.0.13
#r "nuget: ReactiveLock.DependencyInjection, 0.0.13"
#:package ReactiveLock.DependencyInjection@0.0.13
#addin nuget:?package=ReactiveLock.DependencyInjection&version=0.0.13
#tool nuget:?package=ReactiveLock.DependencyInjection&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
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 |
|---|---|---|
| 1.1.0 | 63 | 2/3/2026 |
| 1.0.3-beta.1 | 112 | 9/26/2025 |
| 1.0.2 | 4,982 | 9/25/2025 |
| 1.0.2-beta.1 | 145 | 9/25/2025 |
| 1.0.1 | 1,626 | 9/2/2025 |
| 1.0.0 | 221 | 9/1/2025 |
| 1.0.0-beta-2 | 178 | 9/1/2025 |
| 1.0.0-beta-1 | 201 | 8/31/2025 |
| 0.1.0 | 443 | 8/29/2025 |
| 0.1.0-beta.1 | 186 | 8/29/2025 |
| 0.0.24-beta.1 | 192 | 8/28/2025 |
| 0.0.23 | 462 | 8/26/2025 |
| 0.0.23-beta.1 | 100 | 8/22/2025 |
| 0.0.22 | 1,108 | 8/19/2025 |
| 0.0.22-beta.13 | 144 | 8/19/2025 |
| 0.0.22-beta.10 | 139 | 8/19/2025 |
| 0.0.22-beta.9 | 142 | 8/19/2025 |
| 0.0.22-beta.8 | 139 | 8/19/2025 |
| 0.0.22-beta.7 | 734 | 8/16/2025 |
| 0.0.22-beta.6 | 151 | 8/13/2025 |
| 0.0.22-beta.5 | 199 | 8/11/2025 |
| 0.0.22-beta.4 | 166 | 8/10/2025 |
| 0.0.22-beta.3 | 168 | 8/10/2025 |
| 0.0.22-beta.2 | 131 | 8/9/2025 |
| 0.0.22-beta.1 | 127 | 8/9/2025 |
| 0.0.21 | 1,346 | 7/30/2025 |
| 0.0.20 | 149 | 7/30/2025 |
| 0.0.19 | 171 | 7/29/2025 |
| 0.0.17 | 138 | 7/29/2025 |
| 0.0.16 | 154 | 7/29/2025 |
| 0.0.15 | 243 | 7/26/2025 |
| 0.0.13 | 199 | 7/26/2025 |
| 0.0.12 | 279 | 7/26/2025 |
| 0.0.11 | 369 | 7/25/2025 |
| 0.0.7 | 389 | 7/25/2025 |
| 0.0.6 | 402 | 7/25/2025 |
| 0.0.5 | 426 | 7/25/2025 |