Skip to content

Instantly share code, notes, and snippets.

@ntakouris
Created August 29, 2019 21:49
Show Gist options
  • Save ntakouris/37cd8ca13da642129785603a464e8b00 to your computer and use it in GitHub Desktop.
Save ntakouris/37cd8ca13da642129785603a464e8b00 to your computer and use it in GitHub Desktop.
var redisCacheSettings = new RedisCacheSettings();
configuration.GetSection(nameof(RedisCacheSettings)).Bind(redisCacheSettings);
services.AddSingleton(redisCacheSettings);
if (!redisCacheSettings.Enabled)
{
return;
}
services.AddStackExchangeRedisCache(options => options.Configuration = redisCacheSettings.ConnectionString);
services.AddSingleton<IResponseCacheService, ResponseCacheService>();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment