As we mentioned previously, ASP.NET Core allows us to implement distributed caching. In this section, we will learn how to use Redis as a form of cache storage. It is possible to extend the behavior of the caching mechanism of ASP.NET Core by adding and executing the following CLI instruction in the Catalog.API project:
dotnet add package Microsoft.Extensions.Caching.Redis
By doing this, we can connect the Redis server and use it by adding the following extension method to the Startup class:
public class Startup { ... public void ConfigureServices(IServiceCollection services) { ... services .AddDistributedRedisCache( options => { options.Configuration = "catalog_cache:6380"; }); ... } }}
Microsoft provides ...