سؤال

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?

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top