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
<PackageReference Include="IronAlpine.Caching.Redis" Version="2.1.0" />
<PackageVersion Include="IronAlpine.Caching.Redis" Version="2.1.0" />
<PackageReference Include="IronAlpine.Caching.Redis" />
paket add IronAlpine.Caching.Redis --version 2.1.0
#r "nuget: IronAlpine.Caching.Redis, 2.1.0"
#:package IronAlpine.Caching.Redis@2.1.0
#addin nuget:?package=IronAlpine.Caching.Redis&version=2.1.0
#tool nuget:?package=IronAlpine.Caching.Redis&version=2.1.0
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
Recommended Combination
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:
ICacheServiceICacheSettingsProviderICacheSettingsService
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
dbomapping - 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 | Versions 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. |
-
net10.0
- IronAlpine.Caching (>= 2.0.0)
- IronAlpine.Data.EFCore.Modeling (>= 2.1.0)
- Microsoft.EntityFrameworkCore (>= 9.0.7)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.7)
- Microsoft.Extensions.Caching.Memory (>= 9.0.7)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.7)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.7)
- StackExchange.Redis (>= 2.8.37)
-
net9.0
- IronAlpine.Caching (>= 2.0.0)
- IronAlpine.Data.EFCore.Modeling (>= 2.1.0)
- Microsoft.EntityFrameworkCore (>= 9.0.7)
- Microsoft.EntityFrameworkCore.Relational (>= 9.0.7)
- Microsoft.Extensions.Caching.Memory (>= 9.0.7)
- Microsoft.Extensions.Hosting.Abstractions (>= 9.0.7)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 9.0.7)
- StackExchange.Redis (>= 2.8.37)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Stable mediator release with request/response, notification publish strategies, streaming, and dependency injection integration.