Output Caching Basics
Cache responses to reduce work.
What Is Output Caching?
Output caching stores the full HTTP response of an endpoint so that repeated requests are served from the cache without re-running the handler. This cuts latency and load dramatically for read-heavy endpoints.
// First call -> handler runs, response stored
// Next calls -> response served from cacheOutput Cache vs Response Cache
Built-in output caching (added in .NET 7) stores responses on the server and you fully control it. The older response caching only emits HTTP cache headers and relies on the client or proxies to honor them.
// Output caching: server-side store you control
// Response caching: just Cache-Control headers