I add cache to my application, I have a page which contains several User Control, my problem is I just want to cache the data returned from Controller, but not want to cache all the page content. Since one of my user control is login control, if I cache all the result, then it will behave incorrectly.
my problem is : 1.Is it possible to just cache the dat开发者_如何学Pythona returned from controller ? 2.If a page is cached, can I force a control in the page to be uncached ?I assume by caching you mean output caching (caching just the output html returned after processing the view result of controller). What you are looking for is called cache substitution or "donut caching". As far as I know it is not supported in ASP.NET MVC 1 & 2. In the rc of MVC 3 it is supported as you can read here - http://weblogs.asp.net/scottgu/archive/2010/11/09/announcing-the-asp-net-mvc-3-release-candidate.aspx.
If you want to cache the data you could have the controller stuff it in session and issue it to the view from session when it needs to or get it fresh (and stuff it in session) when it needs to refresh the data.
精彩评论