Skip to content

Latest commit

 

History

History
27 lines (20 loc) · 836 Bytes

File metadata and controls

27 lines (20 loc) · 836 Bytes

Aguacongas.DynamicConfiguration.Redis

Configure your .NET application with Redis.

Usage

Setup

var builder = new ConfigurationBuilder();
builder.AddRedis(options => 
{
	options.ConnectionString = "localhost"; // connection string to your Redis server.
	options.Channel = "Aguacongas.DynamicConfiguration.Redis.Channdel"; // Publication channel to notify configuration change.
	options.HashKey = "Aguacongas.DynamicConfiguration.Redis"; // Key of the Redis hash to store configuration.
	options.Database = 1; // (optional) Redis database to use. When null, the default database is used.
});

var configuration = builder.Build();

Update a configuration

var redisProvider = configuration.Providers.First(p => p is RedisConfigurationProvider);
redisProvider.Set("Key", "Value");