Posted 11/15/2024

ASP.NET Core caching strategies

Cache Type Best for Benefits of usage .Net Tool to Use
In-Memory Caching Single-server Fast data retrieve IMemoryCache
Distributed Caching Multi-server Faster data retrieve than from db, shared state IDistributedCache, Redis
Output Caching Single-server for get and head, fast data retrieve Middleware
Response Caching Single-server Reduce server calls, data are cached on client side or proxy, id depends on configuration Options Middleware
Query Caching Single-server Cache db query results Entity Framework Core Plus EF Core Second Level Cache Interceptor
Hybrid Caching Multi-server For example when we use Cache-Aside pattern with Redis, we have Faster data retrieve and shared state Cache-Aside pattern