How do I 'donut cache' in ASP.NET MVC for something more than a date

拈花ヽ惹草 提交于 2019-12-05 10:25:14

This article might be helpful: http://www.asp.net/Learn/mvc/tutorial-19-cs.aspx (Adding Dynamic Content to a Cached Page in ASP.NET MVC)

"Donut Caching" means using Response.WriteSubstitution method. If you look at MVC source you will see that System.Web.Mvc.Html.RenderPartialExtensions.RenderPartial method is using Response.Output (HtmlHelper.cs, line 277 - last line in 'RenderPartialInternal' method) - so you need create your own html helpers for handling more complex situations.

Note that while this did work in Mvc 1.0, it no longer does in Mvc 2.0. See here: http://haacked.com/archive/2008/11/05/donut-caching-in-asp.net-mvc.aspx

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!