Hitting database for same data 1000 times per second? IMemoryCache stores frequently-accessed data in RAM for instant access. Setup: // Program.cs or Startup.cs builder.Services.AddMemoryCache(); Basic Usage: public class ProductService { private readonly IMemoryCache _cache; private readonly ApplicationDbContext _db; public ProductService(IMemoryCache cache, ApplicationDbContext db) { _cache = cache; _db = db; } public async Task GetProductAsync(int […]
