We've come up with 3 options for providing administration buttons on Actions/pages with caching and would like to know if there are other options or performance/memory/usability issues to be aware of:
- Donut-hole caching - http://haacked.com/archive/2009/05/12/donut-hole-caching.aspx
- VaryByCustom - http://visitmix.com/writings/using-varybycustom-with-outputcache-in-asp-net-mvc-to-support-caching-for-logged-in-users
- Create separate Admin Actions/pages
EDIT: Is there a way to "Overload" Actions? i.e. It would be idea if there was a way to call an Action which has an [OutputCache] attribute for non-admin users and an Action with no [OutputCache] attribute for admin users.
Background: We have a very simple blog and wanted to allow Administrative users to Edit/Delete posts and to approve comments. So, we added buttons that are rendered only for administrative uses using the solution shown in asp.net MVC3 razor: display actionlink based on user role - ".If(User.IsInRole("Administrators"))".
Then, we added [OutputCache(Duration = 30)] to that Action and found that everone would see either the Admin version or the plainer - depending on who happened to be the first to request the page after the cache timed out. Duh...