Posted 10/03/2025

Response Caching vs. Output Caching in ASP.NET

Feature Response Caching Output Caching
Where the cache lives On the client, proxy, CDN (external to server) On the server (in memory, optionally distributed)
How it works Adds HTTP headers (Cache-Control, Vary) so intermediaries can cache responses Stores the generated response on the server and serves it directly without re-executing the endpoint
Best use cases - Public APIs where proxies/CDNs can cache static or rarely-changing data
- Browser caching of GET endpoints (e.g., product catalog, blog posts)
- Expensive server-side computations
- Frequently requested responses where execution cost is high (e.g., report generation, user profile rendering)
Example Response Caching in Minimap API Output Caching in Minimap API
Pros - Offloads server work to client/proxy
- Reduces bandwidth
- Skips re-executing controller/endpoint
- Works even if client disables caching
Cons - Relies on client/proxy honoring headers
- No server control once cached externally
- Increases server memory usage
- Cache invalidation needed when data changes

When to use