Mekik.Redis 0.7.0

dotnet add package Mekik.Redis --version 0.7.0
                    
NuGet\Install-Package Mekik.Redis -Version 0.7.0
                    
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="Mekik.Redis" Version="0.7.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Mekik.Redis" Version="0.7.0" />
                    
Directory.Packages.props
<PackageReference Include="Mekik.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 Mekik.Redis --version 0.7.0
                    
#r "nuget: Mekik.Redis, 0.7.0"
                    
#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 Mekik.Redis@0.7.0
                    
#: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=Mekik.Redis&version=0.7.0
                    
Install as a Cake Addin
#tool nuget:?package=Mekik.Redis&version=0.7.0
                    
Install as a Cake Tool

Mekik.Redis

Redis horizontal-scale backends for mekik — the two ports a fleet needs, so a single-node app becomes N nodes behind a load balancer with no engine changes. The .NET mirror of @mekik/redis; see docs/SCALING.md for the model.

  • RedisTurnLock — a SET NX PX single-writer lease per conversation, so only one node runs a turn at a time. The held lease heartbeats its own TTL, so a long streaming run never lets the lock lapse; a crashed owner's lock expires.
  • RedisBackplane — Redis Pub/Sub cross-node fan-out, so every node holding a tab of a conversation re-fans each frame to its own sockets.
using Mekik;
using StackExchange.Redis;

var redis = await ConnectionMultiplexer.ConnectAsync(builder.Configuration["Redis"]!);

var app = new MekikApp(new MekikOptions
{
    Graph = graph,
    TurnLock  = new RedisTurnLock(redis),   // single-writer lease across nodes
    Backplane = new RedisBackplane(redis),  // cross-node fan-out
});

Pass nothing and mekik keeps its process-local defaults (LocalTurnLock, NoopBackplane) — scaling is entirely opt-in, exactly like History and Conversations.

Built on StackExchange.Redis: share one IConnectionMultiplexer across both. The turn lock uses its database; the backplane uses its subscriber (a multiplexer already manages the subscribe-mode connection internally, so no second connection to wire up).

RedisTurnLock options

new RedisTurnLock(redis, new RedisTurnLockOptions
{
    KeyPrefix = "mekik",                  // share one Redis across apps. Default "mekik".
    Ttl       = TimeSpan.FromSeconds(30), // lock TTL; must exceed a turn's worst case.
    Heartbeat = TimeSpan.FromSeconds(10), // self-renew interval. Default Ttl / 3.
    OnLost    = convId => logger.LogWarning("turn lease lost {Conv}", convId),
});

The lease is token-checked: a node can only renew or release a lock it still holds, so a slow node whose TTL lapsed can never free the new owner's lock. The key is {KeyPrefix}:lock:{conversationId}. The lease releases on DisposeAsync (the engine disposes it when the turn ends).

RedisBackplane options

new RedisBackplane(redis, new RedisBackplaneOptions { KeyPrefix = "mekik" });

The channel is {KeyPrefix}:bp:{conversationId}. The returned subscription unsubscribes on DisposeAsync.

Routing

A fleet needs sticky-by-conversationId ingress so a conversation's connections land on its owner node (the backplane is a fallback for the re-home window, not the steady-state path). conversationId travels in the WebSocket query string so an edge proxy can hash on it without parsing frames. See docs/SCALING.md.

MIT

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.7.0 40 7/31/2026
0.6.0 35 7/30/2026
0.5.0 35 7/30/2026
0.4.0 34 7/28/2026
0.3.0 39 7/28/2026
0.2.1 98 7/24/2026
0.2.0 86 7/24/2026
0.1.0 88 7/23/2026