SetNet.Redis 1.1.0

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

<p align="center"> <img src="https://raw.githubusercontent.com/Povstalez/SetNet/master/assets/icon.png" alt="SetNet" width="96"> </p>

SetNet.Redis

Redis backplane for SetNet — share state across a cluster of server nodes.

SetNet's sessions, bans and room codes live in pluggable stores that default to in-process memory: fine for one server, but they vanish on restart and aren't shared between nodes. This package provides Redis-backed implementations of all three, so when you run several SetNet servers behind a load balancer, they see the same authentication sessions, the same ban list, and the same room codes:

Store Interface Plug into
RedisSessionStore ISessionStore AuthOptions.SessionStore (SetNet.Auth)
RedisBanStore IBanStore server.UseBanList(store) (SetNet.BanList)
RedisRoomStore IRoomStore server.UseRooms(store) / server.UseMatchmaking(store, …) (SetNet.Rooms)

Built on StackExchange.Redis.

Install

dotnet add package SetNet
dotnet add package SetNet.Redis

Usage

Open one connection and share it across the stores:

using SetNet.Redis;
using StackExchange.Redis;

var redis = RedisStores.Connect("localhost:6379");   // or ConnectionMultiplexer.Connect(...)

// Sessions resume on any node and survive restarts:
server.UseAuth(myAuthenticator, new AuthOptions
{
    SessionTtl  = TimeSpan.FromMinutes(10),
    SessionStore = new RedisSessionStore(redis, TimeSpan.FromMinutes(10)),
});

// Bans shared across all nodes (timed bans auto-expire via Redis TTL):
var bans = server.UseBanList(new RedisBanStore(redis));
bans.Ban("203.0.113.7", DateTime.UtcNow.AddHours(1));

// Room codes are unique cluster-wide:
server.UseRooms(new RedisRoomStore(redis));
server.UseMatchmaking(new RedisRoomStore(redis), new MatchmakingOptions { /* ... */ });

Every store takes an optional prefix (default "setnet:") so multiple apps can share one Redis instance without key collisions.

API

Type Constructor Notes
RedisStores.Connect(string) convenience wrapper over ConnectionMultiplexer.Connect
RedisSessionStore (IConnectionMultiplexer mux, TimeSpan ttl = default, string prefix = "setnet:") TTL default 2 min; token rotation preserved
RedisBanStore (IConnectionMultiplexer mux, string prefix = "setnet:") timed bans use Redis key TTL
RedisRoomStore (IConnectionMultiplexer mux, string prefix = "setnet:") atomically reserves unique join codes

Notes

  • Sessions: persisted with a TTL, so a client can resume on any node and after a restart; SweepAsync is a no-op (Redis expires idle sessions itself). Session.LivePeer is a live-connection reference and is not persisted — so the KickExisting multi-session policy can only kick a session whose connection is on the current node. For cross-node kicks, publish a "kick" over SetNet.Cluster.
  • Bans: fully shared; permanent bans are plain keys, timed bans use Redis expiry.
  • Rooms: this store shares room codes/metadata, so matchmaking on any node creates codes others can look up — but a Room's live members are per-node connections and are not stored in Redis. Actual room traffic/broadcast stays node-local (route a room's players to one node, or bridge nodes with SetNet.Cluster). This is the same node-local model documented for SetNet.Rooms.
  • One multiplexer. IConnectionMultiplexer is designed to be shared and thread-safe — create it once and pass it to all three stores.
  • Security. Protect Redis (auth/TLS/private network); it holds session tokens and bans.

Documentation & source

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.1.0 125 7/2/2026