Interview frequency: …
Short answer
It stores complete responses in server memory or Redis, supports cache invalidation by Tags, and uses locking to prevent a Stampede; the older middleware handled only client headers.
Explanation
The older ResponseCaching Middleware relied exclusively on browser headers and gave developers no way to invalidate a cache programmatically after data changed. Modern OutputCaching gives server-side control: tag a route with Tag('products'), then call IOutputCacheStore.EvictByTagAsync('products') after updating a product to immediately invalidate all matching cached responses. It also supports automatic locking to prevent requests from stampeding.
Code example
app.MapGet("/products", async (IProductService s) => await s.GetAllAsync())
.CacheOutput(p => p.Expire(TimeSpan.FromHours(1)).Tag("products"));Common mistakes
- Enabling Output Caching on authenticated routes without including the User ID in the cache key with VaryByValue.