Rig.TUnit.Databases.NoSql.Redis 0.1.0-beta.2

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

Rig.TUnit.Databases.NoSql.Redis

Redis-as-KV-store fixture, sibling to Rig.TUnit.Caching.Redis. Same container, different semantic contract.

What this package is

Redis wears two hats in real systems: a best-effort cache (with eviction, TTLs, dogpile prevention) and a durable key-value store (primary of record for session tokens, counters, distributed locks). The Rig.TUnit split keeps those roles in separate packages so consumers declare intent — UseRedisCache(…) vs UseRedisKv(…). Shares the underlying RedisFixture with Rig.TUnit.Caching.Redis to avoid a duplicate container per test process.

Ships KeyScanHelper — a SCAN-based enumeration wrapper with sensible batch size + match-pattern support, because KEYS * is forbidden in anything touching production-shape data.

When to use it

  • Integration tests where Redis is the primary store (session state, idempotency keys, leaderboards).
  • Tests that need to enumerate keys safely during assertions.
  • Not for: caching scenarios — use Rig.TUnit.Caching.Redis.

Prerequisites

  • .NET 10 SDK
  • Docker Desktop / Colima (Redis image ~120 MB)
  • StackExchange.Redis (transitive)

Quick start

using Rig.TUnit.Caching.Redis.Fixtures;
using Rig.TUnit.Databases.NoSql.Redis.Helpers;
using StackExchange.Redis;

await using var fx = new RedisFixture();
await fx.InitializeAsync();

var db = ConnectionMultiplexer.Connect(fx.ConnectionString).GetDatabase();
await db.StringSetAsync("session:abc", "user-42");

Options

Property Type Default Description
Image string "redis:7-alpine" Image
StartupTimeoutSeconds int 30 Redis boots in ~1 s
Password string? null Off in dev mode
AppendOnly bool false AOF persistence; disabled for test speed

Fixture + helper APIs

  • Rig.TUnit.Databases.NoSql.Redis.Builder.RedisKvRigBuilder
  • Rig.TUnit.Databases.NoSql.Redis.Helpers.KeyScanHelper
  • Shared: Rig.TUnit.Caching.Redis.Fixtures.RedisFixture

Per-test isolation

Per-test key prefix: session:{IsolationKey:short}:*. KeyScanHelper teardown issues SCAN + DEL against the prefix. Cheaper than running a container per test.

Parallelism + performance

  • First-run pull: ~5 s.
  • Warm startup: ~1 s.
  • Per-test prefix scrub: ~5–10 ms per 100 keys.
  • Parallelism: 8+ concurrent tests; key-prefix isolation is effectively free.

Troubleshooting

  • Cross-test data bleed — a test forgot the {IsolationKey} prefix. The KeyScanHelper only scrubs inside the prefix; keys outside linger.
  • ERR SCAN iteration terminated by timeout — increase count batch size (default 100) or reduce the number of keys per test.

See docs/troubleshooting.md#redis.

Provider quirks + edge cases

  • Redis is single-threaded per shard; MULTI/EXEC is atomic but a slow script blocks everyone else. Avoid Lua scripts in tests unless testing them.
  • Keyspace notifications (CONFIG SET notify-keyspace-events "KEA") are off by default; enable explicitly if testing pub/sub on key expiry.

Benchmarks

See RedisKvBenchmarks.cs; baseline in benchmarks/baseline-005.json.

License

MIT. See LICENSE.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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 (1)

Showing the top 1 NuGet packages that depend on Rig.TUnit.Databases.NoSql.Redis:

Package Downloads
Rig.TUnit.All

Meta-package containing every Rig.TUnit.* package. DISCOURAGED — prefer per-feature or per-stack meta-packages (Rig.TUnit, Rig.TUnit.Microservices).

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0-beta.2 43 4/27/2026
0.0.0-alpha.0.14 44 4/26/2026