开发者

Output caching _ViewStart.cshtml and _Layout.cshtml in MVC 3

I am trying to cache the MVC 3 _ViewStart and _Layout pages, am I right in thinking these are not cached by defau开发者_StackOverflowlt? The problem is the VS bult in web server or IIS should be caching my images in these site master pages but it seems to be loading them everytime.

I can put OutputCache attributes on controller but I can't on these pages above as they have no controllers. Is it possible?


_ViewStart and _Layout are only composing elements of the final markup. So by using the [OutputCache] attribute on some controller action you are caching the entire generated HTML from this action, including the view, and you are in fact caching those elements as well.

Unfortunately ASP.NET MVC 3 doesn't support Donut Caching. It supports only Donut Hole Caching. I guess this is something that is going to be improved and added support to in future versions.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜