3

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 data returned from controller ?
2.If a page is cached, can I force a control in the page to be uncached ?

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.