CaeriusNet.Redis 11.2.0

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

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
  • CaeriusNet 11.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.

Documentation · Migration guide · Issues

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 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