EPS.Extensions.RedisConfig 10.1.0

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

EPS.Extensions.RedisConfig

A .NET 10 library that extends Microsoft.Extensions.Configuration to read configuration from Redis cache using Redis.OM.

Features

  • JSON Document Storage: Store your entire configuration as a JSON document in Redis
  • Multiple Storage Modes:
    • String: Store JSON as a plain Redis string (default, no modules required)
    • RedisJSON: Use the RedisJSON module for native JSON storage and querying
  • Multiple Reload Modes:
    • None: Configuration loaded once at startup
    • Polling: Periodically poll Redis for changes
    • Pub/Sub: Real-time configuration updates via Redis Pub/Sub
  • Optional Provider: Gracefully handle Redis unavailability
  • Full Configuration Binding: Works with all standard .NET configuration patterns

Installation

dotnet add package EPS.Extensions.RedisConfig

Usage

Basic Usage

var builder = new ConfigurationBuilder();

builder.AddRedisConfiguration("localhost:6379", "myapp:config");

var configuration = builder.Build();
var value = configuration["MySetting"];

With Polling Reload

builder.AddRedisConfigurationWithPolling(
    connectionString: "localhost:6379",
    configurationKey: "myapp:config",
    pollingInterval: TimeSpan.FromSeconds(30));

With Pub/Sub Reload

builder.AddRedisConfigurationWithPubSub(
    connectionString: "localhost:6379",
    configurationKey: "myapp:config",
    pubSubChannel: "myapp:config:changed");

Full Options Configuration

builder.AddRedisConfiguration(options =>
{
    options.ConnectionString = "localhost:6379";
    options.ConfigurationKey = "myapp:config";
    options.StorageMode = StorageMode.String; // or StorageMode.RedisJson
    options.ReloadMode = ReloadMode.Polling;
    options.PollingInterval = TimeSpan.FromSeconds(15);
    options.Optional = true;
    options.CommandTimeout = TimeSpan.FromSeconds(5);
});

Optional Provider

builder.AddRedisConfiguration(
    connectionString: "localhost:6379",
    configurationKey: "myapp:config",
    optional: true);

RedisJSON Support

If you have the RedisJSON module installed on your Redis server, you can use native JSON storage instead of plain strings.

Basic RedisJSON Usage

builder.AddRedisJsonConfiguration("localhost:6379", "myapp:config");

RedisJSON with Polling

builder.AddRedisJsonConfigurationWithPolling(
    connectionString: "localhost:6379",
    configurationKey: "myapp:config",
    pollingInterval: TimeSpan.FromSeconds(30));

RedisJSON with Pub/Sub

builder.AddRedisJsonConfigurationWithPubSub(
    connectionString: "localhost:6379",
    configurationKey: "myapp:config",
    pubSubChannel: "myapp:config:changed");

Full Options with RedisJSON

builder.AddRedisConfiguration(options =>
{
    options.ConnectionString = "localhost:6379";
    options.ConfigurationKey = "myapp:config";
    options.StorageMode = StorageMode.RedisJson;
    options.ReloadMode = ReloadMode.Polling;
    options.PollingInterval = TimeSpan.FromSeconds(15);
});

Redis Data Format

String Storage (Default)

Store your configuration in Redis as a plain JSON string:

redis-cli SET myapp:config '{"Logging":{"LogLevel":{"Default":"Information"}},"ConnectionStrings":{"Database":"Server=..."}}'

RedisJSON Storage

When using StorageMode.RedisJson, store your configuration using RedisJSON commands:

redis-cli JSON.SET myapp:config $ '{"Logging":{"LogLevel":{"Default":"Information"}},"ConnectionStrings":{"Database":"Server=..."}}'

Configuration Key Flattening

Regardless of storage mode, the JSON is automatically flattened to configuration keys:

  • Logging:LogLevel:Default = "Information"
  • ConnectionStrings:Database = "Server=..."

Pub/Sub Notifications

When using ReloadMode.PubSub, publish a message to the configured channel to trigger a reload:

redis-cli PUBLISH myapp:config:changed "reload"

License

MIT License - see LICENSE file for details.

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

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
10.1.0 80 1/16/2026
10.0.0 44 1/8/2026

Added Redis JSON storage as an additional option.