SaaS CMS has officially launched! Learn more now.

Personalization with Donut Hole Caching


Does anyone know if personalization works togher with Donut Hole Caching in Episerver CMS?

What I want to achive is to show different version of one block based on visior group in content area. This works in login mode, but not anoymous.

  1. I put EpiserverDonutCacheAttribute on page type controller
  2. On the block where I want to use personalization I add [ChildActionOnly] on ActionResult
  3. On page view I create a hole for content area by using Html.DonutForContentArea(Model.CurrentPage.MainContentArea);

We were foreced to use donut hole cache because block in block publishing doesn't work with Episerver output caching (Correct me if I am wrong). Now we are trying to use personalization, but donut hole caching doesn't recognize personalization on the block. It just caches first loaded version and ignore the visitor groups I configured.

I also tried episerver output caching together with personalization, it works. Unfortunately block in block publishing doesn't work.

Here are the articles which inspired me:


Sep 27, 2021 13:39

Yes personalization works fine if you're just caching the block output. It's a primary reason to cache at the block level rather than page where this can cause issues with visitor groups.

Sep 27, 2021 15:11
Scott Reed - Sep 27, 2021 15:14
I do however use a completely different approach to doing it. Which is to just

1. Use an output cache on the block with varybyparm set to "currentBlock"
2. Override the ToString() on the block types to generate a unique cache key

Using this method for years and works like a charm
YoYo - Sep 28, 2021 6:30
I will test your approach and use output cache on block level, not page level. Thank you very much!
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.