Fluens.Caching.Redis
0.9.4
dotnet add package Fluens.Caching.Redis --version 0.9.4
NuGet\Install-Package Fluens.Caching.Redis -Version 0.9.4
<PackageReference Include="Fluens.Caching.Redis" Version="0.9.4" />
<PackageVersion Include="Fluens.Caching.Redis" Version="0.9.4" />
<PackageReference Include="Fluens.Caching.Redis" />
paket add Fluens.Caching.Redis --version 0.9.4
#r "nuget: Fluens.Caching.Redis, 0.9.4"
#:package Fluens.Caching.Redis@0.9.4
#addin nuget:?package=Fluens.Caching.Redis&version=0.9.4
#tool nuget:?package=Fluens.Caching.Redis&version=0.9.4
Fluens.Caching.Redis
Redis distributed cache (L2) configuration for HybridCache via Fluens builder infrastructure.
Installation
dotnet add package Fluens.Caching.Redis
Usage
There is no IFluensBuilder extension for Redis - the only way to opt in is the nested callback on
AddCaching (ADR 20260725000001):
fluensBuilder.AddCaching(c => c.AddRedis(r =>
{
r.ConnectionString = "localhost:6379";
}));
Configuration section: Fluens:Caching:Redis. Instance name defaults to {IApplicationIdentity.Key}: for key isolation.
RedisCachingOptions
| Property | Type | Default | Description |
|---|---|---|---|
Enabled |
bool |
true |
When false, Redis is not registered and a later enabled AddRedis call still registers it (HybridCache L1 still works) |
ConnectionString |
string? |
null |
Redis connection string. Required when enabled |
InstanceName |
string? |
null |
Redis key prefix. Defaults to {IApplicationIdentity.Key}: when not set and Fluens:App:Name is not blank; when both are missing, registration throws |
Throws OptionsException<RedisCachingOptions> when ConnectionString is missing after config +
callback (Redis never registers with a null connection string). Throws an exception naming both
Fluens:App:Name and InstanceName when InstanceName is not set and IApplicationIdentity.Name
(Fluens:App:Name) is blank, even if Instance is set - without a name the key would collapse to the
instance value alone and different apps would share a key prefix. The error is thrown inside AddCaching
(at registration time) by every enabled AddRedis call; a disabled AddRedis does not throw. A missing
Fluens:App section fails earlier, in AddFluens().
Validation is deferred behind AddCaching's own CachingOptions.Enabled gate: AddRedis(...)
queues everything - binding, your callback, and validation - and none of it runs unless caching is
actually enabled. AddCaching(c => c.AddRedis()) with Fluens:Caching:Enabled=false never throws,
even with no ConnectionString configured at all.
Repeated AddRedis calls
Every AddRedis call, in one AddCaching callback or across several AddCaching calls, applies its callback to the one shared RedisCachingOptions and validates it, so the last value written wins and an invalid value from a later call fails with OptionsException<RedisCachingOptions>. The Redis services (IDistributedCache and its RedisCacheOptions configuration) are registered once per host. ConnectionString and InstanceName are read when RedisCacheOptions is resolved, so the resolved options carry the values of the last call:
fluensBuilder.AddCaching(c => c.AddRedis(r => r.ConnectionString = "first:6379"));
fluensBuilder.AddCaching(c => c.AddRedis(r => r.ConnectionString = "second:6379")); // resolved: second:6379
Disabling Redis after it was registered
Redis cannot be switched off once an earlier AddRedis call registered it. An AddRedis call that sets Enabled = false after an enabled one, in the same AddCaching callback or in an earlier AddCaching call, throws InvalidOperationException naming Fluens:Caching:Redis: the registered Redis services would stay active on values that call never validated. A disabled call before any enabled one is harmless, and a later enabled call then registers Redis.
License
This project is licensed under the MIT License.
| 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
- Fluens.Caching (>= 0.9.4)
- Microsoft.Extensions.Caching.Hybrid (>= 10.11.0)
- Microsoft.Extensions.Caching.StackExchangeRedis (>= 10.0.13)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.13)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Hosting.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Logging.Abstractions (>= 10.0.13)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.13)
- Scrutor (>= 7.0.0)
- StackExchange.Redis (>= 3.4.5)
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 |
|---|---|---|
| 0.9.4 | 89 | 11/30/2026 |
| 0.9.3 | 112 | 11/17/2026 |
| 0.9.2 | 154 | 10/21/2026 |
| 0.9.1 | 125 | 10/13/2026 |
| 0.9.0 | 117 | 10/13/2026 |
| 0.8.7 | 110 | 10/12/2026 |
| 0.8.6 | 106 | 10/12/2026 |
| 0.8.5 | 116 | 10/7/2026 |
| 0.8.4 | 99 | 10/6/2026 |
| 0.8.3 | 106 | 10/6/2026 |
| 0.8.2 | 116 | 10/5/2026 |
| 0.8.1 | 131 | 9/15/2026 |
| 0.8.0 | 117 | 9/15/2026 |
| 0.7.11 | 117 | 9/15/2026 |
| 0.7.10 | 121 | 9/13/2026 |
| 0.7.9 | 124 | 9/11/2026 |
| 0.7.8 | 128 | 9/10/2026 |
| 0.7.7 | 137 | 9/10/2026 |
| 0.7.6 | 157 | 7/1/2026 |
| 0.7.5 | 159 | 6/22/2026 |