ReactiveLock.DependencyInjection
0.0.11
Prefix Reserved
See the version list below for details.
dotnet add package ReactiveLock.DependencyInjection --version 0.0.11
NuGet\Install-Package ReactiveLock.DependencyInjection -Version 0.0.11
<PackageReference Include="ReactiveLock.DependencyInjection" Version="0.0.11" />
<PackageVersion Include="ReactiveLock.DependencyInjection" Version="0.0.11" />
<PackageReference Include="ReactiveLock.DependencyInjection" />
paket add ReactiveLock.DependencyInjection --version 0.0.11
#r "nuget: ReactiveLock.DependencyInjection, 0.0.11"
#:package ReactiveLock.DependencyInjection@0.0.11
#addin nuget:?package=ReactiveLock.DependencyInjection&version=0.0.11
#tool nuget:?package=ReactiveLock.DependencyInjection&version=0.0.11
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.0.3-beta.1 | 98 | 9/26/2025 |
| 1.0.2 | 4,870 | 9/25/2025 |
| 1.0.2-beta.1 | 144 | 9/25/2025 |
| 1.0.1 | 1,625 | 9/2/2025 |
| 1.0.0 | 220 | 9/1/2025 |
| 1.0.0-beta-2 | 177 | 9/1/2025 |
| 1.0.0-beta-1 | 198 | 8/31/2025 |
| 0.1.0 | 442 | 8/29/2025 |
| 0.1.0-beta.1 | 183 | 8/29/2025 |
| 0.0.24-beta.1 | 191 | 8/28/2025 |
| 0.0.23 | 460 | 8/26/2025 |
| 0.0.23-beta.1 | 97 | 8/22/2025 |
| 0.0.22 | 1,106 | 8/19/2025 |
| 0.0.22-beta.13 | 141 | 8/19/2025 |
| 0.0.22-beta.10 | 137 | 8/19/2025 |
| 0.0.22-beta.9 | 141 | 8/19/2025 |
| 0.0.22-beta.8 | 136 | 8/19/2025 |
| 0.0.22-beta.7 | 733 | 8/16/2025 |
| 0.0.22-beta.6 | 149 | 8/13/2025 |
| 0.0.22-beta.5 | 198 | 8/11/2025 |
| 0.0.22-beta.4 | 164 | 8/10/2025 |
| 0.0.22-beta.3 | 166 | 8/10/2025 |
| 0.0.22-beta.2 | 130 | 8/9/2025 |
| 0.0.22-beta.1 | 126 | 8/9/2025 |
| 0.0.21 | 1,345 | 7/30/2025 |
| 0.0.20 | 147 | 7/30/2025 |
| 0.0.19 | 170 | 7/29/2025 |
| 0.0.17 | 137 | 7/29/2025 |
| 0.0.16 | 152 | 7/29/2025 |
| 0.0.15 | 241 | 7/26/2025 |
| 0.0.13 | 197 | 7/26/2025 |
| 0.0.12 | 277 | 7/26/2025 |
| 0.0.11 | 368 | 7/25/2025 |
| 0.0.7 | 388 | 7/25/2025 |
| 0.0.6 | 400 | 7/25/2025 |
| 0.0.5 | 425 | 7/25/2025 |