SetNet.Redis
1.1.0
dotnet add package SetNet.Redis --version 1.1.0
NuGet\Install-Package SetNet.Redis -Version 1.1.0
<PackageReference Include="SetNet.Redis" Version="1.1.0" />
<PackageVersion Include="SetNet.Redis" Version="1.1.0" />
<PackageReference Include="SetNet.Redis" />
paket add SetNet.Redis --version 1.1.0
#r "nuget: SetNet.Redis, 1.1.0"
#:package SetNet.Redis@1.1.0
#addin nuget:?package=SetNet.Redis&version=1.1.0
#tool nuget:?package=SetNet.Redis&version=1.1.0
<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;
SweepAsyncis a no-op (Redis expires idle sessions itself).Session.LivePeeris a live-connection reference and is not persisted — so theKickExistingmulti-session policy can only kick a session whose connection is on the current node. For cross-node kicks, publish a "kick" overSetNet.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 withSetNet.Cluster). This is the same node-local model documented forSetNet.Rooms. - One multiplexer.
IConnectionMultiplexeris 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
- 🐙 https://github.com/Povstalez/SetNet — full module catalog in docs/MODULES.md
License
MIT
| Product | Versions 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. |
-
.NETStandard 2.1
- SetNet (>= 1.1.0)
- SetNet.Auth (>= 1.1.0)
- SetNet.BanList (>= 1.1.0)
- SetNet.Rooms (>= 1.1.0)
- StackExchange.Redis (>= 2.8.16)
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 |