OutputCache an ActionResult that only returns a View

71 Views Asked by At

Would it make sense to [OutputCache] something like this?

[HttpGet]
public ActionResult About()
{
    return this.View("About");
}
1

There are 1 best solutions below

2
Rahatur On BEST ANSWER

It depends on what is in the View. For example if it a heavier view and the output is same for all the users then yes you should use the [OutputCache] filter. This will reduce the timing on the server side for:

  • View relocation
  • View parsing

When you use the [OutputCache] filter consider setting the parameters properly. i.e. cache duration and others as needed.