Personalization with Donut Hole Caching

Vote:
 

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:
://www.david-tec.com/2014/03/Enabling-output-caching-on-an-EPiServer-site-that-uses-Visitor-Groups

://www.jondjones.com/learn-episerver-cms/episerver-developers-tutorials/episerver-caching/how-to-implement-a-donut-hole-cache-in-episerver

#263934
Sep 27, 2021 13:39
Vote:
 

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.

#263937
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!
* 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.