CaeriusNet.Redis
11.2.0
dotnet add package CaeriusNet.Redis --version 11.2.0
NuGet\Install-Package CaeriusNet.Redis -Version 11.2.0
<PackageReference Include="CaeriusNet.Redis" Version="11.2.0" />
<PackageVersion Include="CaeriusNet.Redis" Version="11.2.0" />
<PackageReference Include="CaeriusNet.Redis" />
paket add CaeriusNet.Redis --version 11.2.0
#r "nuget: CaeriusNet.Redis, 11.2.0"
#:package CaeriusNet.Redis@11.2.0
#addin nuget:?package=CaeriusNet.Redis&version=11.2.0
#tool nuget:?package=CaeriusNet.Redis&version=11.2.0
CaeriusNet.Redis
CaeriusNet.Redis adds typed, fully asynchronous Redis caching to CaeriusNet 12. It reuses one
IConnectionMultiplexer, uses asynchronous StringGetLeaseAsync reads, and writes a versioned binary envelope with the
codec identifier, contract hash and logical-tag generation snapshot. A changed DTO or incompatible payload is therefore
a safe cache miss, never an unsafe deserialization.
Prerequisites
- .NET 10 and C# 14
CaeriusNet11.2.0- A Redis endpoint supported by StackExchange.Redis
- SQL Server 2022 or 2025 for the CaeriusNet database runtime
dotnet add package CaeriusNet.Redis --version 11.2.0
Configure
using CaeriusNet;
using CaeriusNet.Redis;
using Microsoft.Extensions.DependencyInjection;
using StackExchange.Redis;
services.AddCaeriusNet(options => options.UseSqlServer(sqlConnectionString));
// Aspire's AddRedisClient registers this singleton for you. In a plain host, create it
// asynchronously during composition and reuse it for the lifetime of the application.
var multiplexer = await ConnectionMultiplexer.ConnectAsync(redisConnectionString);
services.AddSingleton<IConnectionMultiplexer>(multiplexer);
services.AddCaeriusNetRedis(options => options.MaxPayloadBytes = 1024 * 1024);
services.AddCaeriusCacheCodec<Customer, CustomerCacheCodec>();
Use a generated DTO codec through its generated registration extension, or register a manual ICaeriusCacheCodec<T> as
above. Redis caching is deliberately unavailable for a result shape with no registered codec.
var command = new StoredProcedureCommandBuilder("dbo", "usp_Customer_List")
.DependsOn("customer")
.UseRedisCache(TimeSpan.FromMinutes(5))
.Build();
var customers = await database.QueryImmutableArrayAsync<Customer>(command, cancellationToken: ct);
Keys use caerius:v2:<sha256>, generated from length-prefixed binary contract fields. Tag generations are stored and
validated atomically with each payload by Redis 7.4-compatible Lua scripts: a slow SQL fallback begun before a write
cannot publish a stale value after that write invalidates a matching tag. Use Invalidates("customer") on the durable
write, not a literal cache key.
Read-through lookup and population failures are logged and fall through to SQL. A flight is cancelled when its final
waiter leaves. Explicit writes, removes and invalidations are strict. If SQL has committed but invalidation fails,
CaeriusCacheInvalidationException.SqlWasCommitted is true; do not retry a non-idempotent procedure blindly. Corrupt
payloads are compare-deleted best-effort and counted as misses. Payloads above MaxPayloadBytes (1 MiB by default) are
not published. A multi-result execution is cached as one aggregate value under one key, never set-by-set.
| Product | Versions 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. |
-
net10.0
- CaeriusNet (>= 11.2.0)
- StackExchange.Redis (>= 3.1.31)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on CaeriusNet.Redis:
| Package | Downloads |
|---|---|
|
CaeriusNet.Aspire
.NET Aspire SQL Server and Redis integration for CaeriusNet with health checks and OpenTelemetry wiring. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.2.0 | 32 | 8/21/2026 |