Into ASP.NETMVC, the OutputCaching basically allows you to store the output of a particular controller in the memory. So, any future request coming for the same action in that controller will be returned from the cached result. This way, the same content does not need to be generated each and every time the same controller action is invoked.
VaryByParam
VaryByHeader
public class Startup
{
public void ConfigureServices(IServiceCollection services)
{
services.AddOutputCaching();
services.AddMvc();
}
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
app.UseOutputCaching();
app.UseMvcWithDefaultRoute();
}
}
Markdown for AI
A clean, structured version of this page for AI assistants and LLMs.
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Into ASP.NET MVC, the OutputCaching basically allows you to store the output of a particular controller in the memory. So, any future request coming for the same action in that controller will be returned from the cached result. This way, the same content does not need to be generated each and every time the same controller action is invoked.