This question already has an answer here:
I'm writing an ASP.NET MVC site where I'm running into a dilmena on how to set up proper caching. I'm trying to achieve something similar to how Stack Overflow works with caching, in that all pages are cached while:
- Showing the username of the current user, as well as badges and reputation
- Dynamically hiding/showing certain action links (e.g., the "edit" link on a question is only visible to some users)
- and more
How is this implemented?
I've tried looking through the SEDE code, but haven't found anything related to caching (probably because SEDE runs on Azure, so it's more complicated). One possible strategy that I can think of is donut or substitution caching, but Phil Haack says that it's not recommended for ASP.NET MVC 2.