Question

I like the simplicity and usability that OutputCache offers in MVC Controllers. I could see a usage for such caching functionality in other "heavy" functions that are not controller actions, but since it is in the System.Web.Mvc namespace I was curios to know weather or not it is intended for that kind of use?

Was it helpful?

Solution

It's not intended nor will it work for caching the output of a method. Looking at the source code of the OutputCache attribute, it looks like it's very tightly coupled to the HttpContext and actually writes out to the response. So it's really meant for caching the HTML output of your actions.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top