It is possible to extend the behavior of the IDistributedCache interface by overloading the extension methods. Furthermore, we need to store complex information and not bytes. For example, in the case of the ItemController class, we want to pass the ItemResponse type to the Set method of the IDistributedCache interface.
Let's proceed by modifying the DistributedCacheExtensions class in the Catalog.API project:
using System.Threading.Tasks;using Catalog.Domain.Configurations;using Microsoft.Extensions.Caching.Distributed;using Microsoft.Extensions.Configuration;using Microsoft.Extensions.DependencyInjection;using Newtonsoft.Json;namespace Catalog.Infrastructure.Extensions{ public static class ...