In this tutorial, you will learn how the output cache works and how you can use it to cache pages on your website to improve performance.  When applying an output caching strategy there are several paths that you can consider:

1. 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

2. .NET 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:

3. Partial Page Caching- Donut Caching

In donut caching you cache the whole page except the areas that change very frequently.

4. Partial Page Caching- Donut Hole Caching

In donut hole caching you never cache the full page. 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.

5. Donut Caching in Episerver

Now we have a clear idea about the different strategies of caching, it is up to you to decide what solution is most relevant to your website.  In general, the higher amount of traffic your site experiences and how dynamic and frequent your pages update, will be the biggest factor.  If you have an e-commerce site and want your prices displayed in real time, then donut caching is your best bet. 

If you have pages that rarely ever update, then full-page caching is usually your best option. If after reading this you have decided to go with a donut based approach, then I would recommend reading, Episerver Donut caching. I should warn you now, when you start caching e-commerce products, you need to think about a cache invalidation strategy as well.  This can be very tricky. Good Luck!