This is the fifth post in my series covering output caching in Episerver. As the number of posts implies, caching in Episerver can be complicated. In the previous guides, we've talked about when and why you may not use 'full page' caching and why you might want to implement donut caching. In this post, I'm going to cover an Episerver donut caching package that I have created and that you can use in your projects to quickly implement donut hole caching.
[EpiserverDonutCache(Duration = 24 * 3600)]
public ActionResult Index(StartPage currentPage)
return View("Index", new StartPageViewModel(currentPage, EpiserverDependencies));
[ChildActionOnly, EpiserverDonutCache(Duration = 60)]
[ChildActionOnly, EpiserverDonutCache(Duration = 60, Options = OutputCacheOptions.ReplaceDonutsInChildActions)]
public override ActionResult Index(DonutExampleBlock currentBlock)
var displayTag = GetDisplayOptionTag();
Donut One cached at: @Model.TheTime (expires every 60 seconds)
@foreach(var content in Model.Content)
CustomTag = "ul",
CssClass = "ul-class",
ChildrenCustomTagName = "li",
ChildrenCssClass = "li-class",
Tag = "wide"
Software Architect, Programmer and Technologist Jon Jones is founder and CEO of London-based tech firm Digital Prompt. He has been working in the field for nearly a decade, specializing in new technologies and technical solution research in the web business. A passionate blogger by heart , speaker & consultant from England.. always on the hunt for the next challenge