Skip to content

Instantly share code, notes, and snippets.

@bjornmicallef
Created June 22, 2021 11:23
Show Gist options
  • Save bjornmicallef/202972aa3ccbed98840888ac3d978ac2 to your computer and use it in GitHub Desktop.
Save bjornmicallef/202972aa3ccbed98840888ac3d978ac2 to your computer and use it in GitHub Desktop.
public void ConfigureServices(IServiceCollection services)
{
services.AddControllers();
services.AddMemoryCache();
services.AddSingleton<IConnectionMultiplexer>(provider => ConnectionMultiplexer.Connect("your redis connection string"));
services.AddScoped<ICacheService, CacheService>();
services.AddScoped<IWeatherService, WeatherService>();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment