Output caching for "almost static" pages in asp.net mvc

Most web applications have pages that are "almost static" in the sense that they very rarely change their content, but when they change, it should be immediately visible on the page.

So, if you have an OutputCache attribute that allows you to cache forever on your PageShow method, the cache should be immediately invalidated by calling the PageUpdate method.

Sometimes the page data is almost identical, but a small part (for example, the username). Here I have the option to render the entire page causing different partial renders, or just move some of the cache outside of the controller to reduce the most expensive calls to the db to get data (i.e.: the cache at the service repository level).

Is there a pattern to effectively use both types of caching on asp.net mvc?

+2


source to share


1 answer


What you suggested is a common scenario - especially with usernames.

This is called donut caching and is a very important feature.

Here is a helpful fooobar.com/questions/506463 / ... on the same topic .. that bounces off you to this blog post (perhaps the most helpful link on this topic regarding ASP.NET MVC).




A quick google search for this brings up a number of useful pages.

NTN!

+2


source







All Articles