Episerver Caching - Output Caching Strategies Explained.... What Is a Donut Cache?
In the previous articles I've talked about how to use the Output cache to cache objects in your website. When applying an output caching strategy there are several paths that you can consider: Full Page Caching In a full page solution, you use the built-in OutputCache attribute on your Episerver page type controller and the whole page is cache. In most basic brochureware type sites this is usually the route I would recommend. It is also the simplest, I would recommend reading Episerver Caching - The Output Cache Explained Donut Hole Caching In certain situations, caching a whole page might not be the best approach. For example, in an e-commerce project, if you change the price of an item in stock and that item is displayed on many pages, invalidating the whole page isn't the most efficient use of your cache. Say your website has 20 different languages and the product in question appears on 5 pages. When you update the price of your product, you have a dilemma.. one, you have to invalidate 20 pages * 5 pages, so 100 pages. (language variations * pages affected). In an extremely high load site, this would cause you a stampeding herd effect where 10,000 people might all request these pages at the same time and your web server has to go off and re-generate the whole page. Instead of getting the web server to generate the whole pages HTML again, instead we can create a donut cache. Donut caching comes in two flavors: Partial Page Caching- Donut Caching In donut caching you cache the whole page except the areas that change very frequently. Partial Page Caching- Donut Hole Caching In donut hole caching you never cache the full page, instead you cache parts of a page. If you put the output cache attribute on one or more of your blocks then you are using a donut hole approach.