IronAlpine.Caching.Redis 2.1.0

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

IronAlpine.Caching.Redis

IronAlpine.Caching.Redis provides Redis-backed caching infrastructure for IronAlpine services.

It covers:

  • distributed cache service
  • cache settings persistence
  • cache definition support
  • multi-node invalidation through Redis pub/sub
  • EF model contribution for cache settings tables

Why

Use this package when a service needs distributed cache behavior, central cache settings, and cluster-safe invalidation.

This package exists so services do not re-implement Redis cache access, cache policy tables, and invalidation plumbing differently in every codebase.

Install

dotnet add package IronAlpine.Caching.Redis
dotnet add package IronAlpine.Caching
dotnet add package IronAlpine.Caching.Redis
dotnet add package IronAlpine.Data.EFCore.Modeling

Public Surface

Main registration method:

  • AddIronAlpineCachingRedis<TDbContext>(configureRedis, configureEfCore)

Primary runtime services:

  • ICacheService
  • ICacheSettingsProvider
  • ICacheSettingsService

Quick Start

builder.Services.AddIronAlpineCachingRedis<AppDbContext>(
    configureEfCore: options =>
    {
        options.CacheKeyMaxLength = 200;
    });

Configuration

Configuration root:

{
  "IronAlpine": {
    "Caching": {
      "Redis": {
        "ConnectionString": "localhost:6379",
        "InstanceName": "personnel-service",
        "DefaultDatabase": 0,
        "AbortOnConnectFail": false,
        "ConnectRetry": 5,
        "ConnectTimeoutMilliseconds": 5000,
        "EnableTtlJitter": true,
        "MaxTtlJitterSeconds": 30,
        "CacheSettingsInvalidationChannel": "personnel-service:caching:settings:invalidate",
        "EFCore": {
          "CacheKeyMaxLength": 200
        }
      }
    }
  }
}

Redis Options Deep Dive

ConnectionString

  • required
  • Redis connection endpoint(s)
  • startup should fail fast if distributed cache is expected and this is missing

InstanceName

  • required
  • namespace/prefix for cache keys
  • prevents collisions across services sharing the same Redis cluster

DefaultDatabase

  • optional
  • selects the logical Redis database used by the cache service

AbortOnConnectFail

  • defaults to false
  • keeps the application from failing permanently on transient startup connectivity issues

ConnectRetry

  • defaults to 5
  • controls how many reconnect attempts StackExchange.Redis should make

ConnectTimeoutMilliseconds

  • defaults to 5000
  • controls the initial connect timeout for the multiplexer

MaxTtlJitterSeconds

  • recommended in clustered environments
  • reduces synchronized expiry spikes and stampedes

EF Core Options

CacheKeyMaxLength

  • use explicit values when migration stability matters across existing databases

CacheSettingsSchema

  • optional
  • leave empty for the default dbo mapping
  • only set this when the cache settings table must live in a non-default schema

cache settings table naming

  • default table: CacheSettings
  • contributor-based mapping keeps table registration automatic once the package is registered

Behavior Notes

  • cache settings are persisted in the database
  • settings are cached in-memory per application instance
  • updates and deletes publish invalidation events through Redis pub/sub so other nodes purge their local view

Combinations

Caching.Redis + Web.AspNetCore

Use with web hosts that expose cache administration endpoints.

Caching.Redis + Messaging

Recommended when cache invalidation is event-driven across service boundaries.

Caching.Redis + Data.EFCore

Use when the cache settings table lives in the same service database.

Troubleshooting

Cache values never expire when expected

Cause:

  • cache definition overrides default TTL
  • sliding expiration keeps renewing hot keys

Fix:

  • inspect cache definition and global Redis options together

Multi-node invalidation does not propagate

Cause:

  • Redis pub/sub not connected
  • inconsistent configuration across nodes

Fix:

  • verify all nodes share the same Redis cluster and pub/sub configuration

Cache settings table is missing

Cause:

  • contributor/modeling registration missing

Fix:

  • verify package registration and EF modeling foundation package presence
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  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 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

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
2.1.0 894 4/10/2026
2.0.0 672 4/2/2026
Loading failed

Stable mediator release with request/response, notification publish strategies, streaming, and dependency injection integration.