ReactiveLock.Distributed.Redis 0.0.13

There is a newer version of this package available.
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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ReactiveLock.Distributed.Redis" Version="0.0.13" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="ReactiveLock.Distributed.Redis" Version="0.0.13" />
                    
Directory.Packages.props
<PackageReference Include="ReactiveLock.Distributed.Redis" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add ReactiveLock.Distributed.Redis --version 0.0.13
                    
#r "nuget: ReactiveLock.Distributed.Redis, 0.0.13"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package ReactiveLock.Distributed.Redis@0.0.13
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ReactiveLock.Distributed.Redis&version=0.0.13
                    
Install as a Cake Addin
#tool nuget:?package=ReactiveLock.Distributed.Redis&version=0.0.13
                    
Install as a Cake Tool

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 of ReactiveLock.Core.

  • ReactiveLock.DependencyInjection
    Dependency Injection extensions for controller, state, and factory services with keyed resolution support for ReactiveLock.Distributed.* libs..


Concepts

  • Tracker Controller (IReactiveLockTrackerController)
    Call IncrementAsync() / DecrementAsync() to mark this instance busy or idle.

  • Tracker State (IReactiveLockTrackerState)
    Call IsBlockedAsync() or WaitIfBlockedAsync() 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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