CasCap.Common.Configuration.Redis 5.2.1

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

CasCap.Common.Configuration.Redis

Optional .NET 10/11 cache-aside acceleration for typed runtime configuration, backed by an independently authoritative store. This bounded cache-aside adapter is not a durable Redis provider.

Installation

dotnet add package CasCap.Common.Configuration.Redis

Usage

First register a durable provider and the existing shared CasCap cache. Then opt in through AddRuntimeConfigurationCache<T, TStore>:

using CasCap.Common.Configuration.PostgreSql.Extensions;
using CasCap.Common.Configuration.PostgreSql.Services;
using CasCap.Common.Configuration.Redis.Extensions;
using CasCap.Common.Configuration.Redis.Models;
using CasCap.Common.Configuration.Runtime.Models;

builder.Services.AddPostgresRuntimeConfiguration(
    new RuntimeConfigurationOptions
    {
        Scope = new RuntimeConfigurationScope("example-application", builder.Environment.EnvironmentName),
        ContractId = "controls",
    }, databaseConnection, baseline);
builder.Services.AddCasCapCaching(remoteCacheConnectionString: redisConnection);
builder.Services.AddRuntimeConfigurationCache<Controls, PostgresRuntimeConfigurationStore<Controls>>(
    new RuntimeConfigurationCacheOptions { AuthorityId = "example-database-schema" });

databaseConnection, redisConnection, baseline and the Controls DTO are host-owned. Reuse an already registered cache rather than opening another Redis connection. Connections belong in the existing secret-store chain, never in the runtime DTO.

The consumer guide supplies the direct-provider setup, typed publisher, migration and subscriber lifecycle. This package changes only the reader: publication still uses the uncached IRuntimeConfigurationPublisher<T> and commits to the selected authority first. For SQLite, use AddSqliteRuntimeConfiguration and SqliteRuntimeConfigurationStore<Controls> instead; the same cache registration and authority-identity rules apply.

Configuration Examples

RuntimeConfigurationCacheOptions is immutable deployment configuration, not a live control:

new RuntimeConfigurationCacheOptions
{
    AuthorityId = "example-database-schema",
    MaximumAge = TimeSpan.FromSeconds(30),
    ReconciliationInterval = TimeSpan.FromMinutes(1),
}
  • AuthorityId is required, non-secret and unique to the durable database/schema or file. Use the same value across its replicas, and different values for different authorities.
  • MaximumAge defaults to 30 seconds; supported bounds are 100 milliseconds to five minutes.
  • ReconciliationInterval defaults to one minute, must be at least MaximumAge, and cannot exceed ten minutes.
  • Cached entries use absolute expiry with up to ten percent shorter jitter, never sliding renewal. Authority identity, application, environment, contract ID and contract version form the hashed lowercase configuration:cache:v1:... key. The envelope repeats that identity.

Behavior and Limits

CachedRuntimeConfigurationStore<T> performs an uncached durable read at startup, even with a warm cache. Later polls use shared IDistributedCache cache-aside loading and revalidate snapshots. Each instance independently bypasses Redis at its reconciliation interval. Cached values are copied before returning; callers must still treat options as immutable.

Redis is evictable cache only. Deletion or eviction causes refill; it never deletes SQL history. Malformed, wrong-scope, expired or previously superseded cache entries trigger a durable read. The first bypass logs one sanitized Warning, repeats log at Debug with the count, and the next successful cache read logs one Information recovery with the bypass count and duration. Redis connection failures also fall back to the authority. If that read fails, normal runtime-reader retention, expiry and sanitized failure behavior apply; Redis is not an availability substitute for required initial PostgreSQL or SQLite loading.

The host still owns shared Redis connection registration and its timeout/abort-connect policy. AddCasCapCaching connects during registration; a connection-registration failure occurs before this decorator can fall back. Configure that existing client appropriately if the application must start while Redis is unavailable. The trial does not open a parallel connection or override shared cache settings.

Typed publication and direct operator SQL deliberately do not invalidate this trial's entries. They become visible after cache age expiry or independent reconciliation, followed by the next poll and source-read duration. Bounds assume healthy dependencies and do not promise a hard deadline. A delayed stale refill can remain cached, but cannot move a reader below a revision it already observed. Reconciliation bypasses even a repeatedly stale cache. No outbox, fenced shared pointer, pub/sub delivery guarantee, distributed writer lock or immediate read-your-write promise is added.

Shared caching suppresses concurrent fills per key within a process. Cross-process duplicate fills can still occur; do not enable distributed locking without evaluating its cost and endpoint safety. Cache calls have the shared client's timeout semantics; cancellation stops waiting but an in-flight shared fill can finish afterward. Cache serialization is an internal format, not a public API. A fill whose absolute deadline expires before storage is rejected as a bypass and retried directly against the authority, rather than extending the stale entry's lifetime.

This trial has no measured production performance benefit yet and is not deployed by opting into the source project. Keep the direct provider for low-volume or stricter-freshness workloads. See the ADR and acceptance tests.

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.  net11.0 is compatible. 
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
5.2.1 95 11/21/2026
5.2.0 101 11/14/2026
5.1.0 98 11/5/2026
5.0.0 111 11/1/2026