Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.
SOLVED

Experience Fragment issue in Dispatcher

Avatar

Level 2

Hi,

When we are publishing experience fragment only, its not updating the page in which we are using that XF in dispatcher.

Below are the steps we have followed:

  • Create and edit an XF and publish it.
  • Create a page and add XF created in previous step and publish the page.
  • Now edit the XF and publish it. Do not publish page.

In publisher, we are able to see the the XF content updated in page even if it is not published. But in dispatcher we are seeing old content only.

Please suggest if we need any configuration change for this.

Thanks!

1 Accepted Solution

Avatar

Correct answer by
Level 3

dispatcher flush listeners get triggered when a replication/publish request get initiated. In your case no activation, hence no dispatcher flush. You need to publish the page after XF change to get cache updated or write your own listeners.

View solution in original post

9 Replies

Avatar

Correct answer by
Level 3

dispatcher flush listeners get triggered when a replication/publish request get initiated. In your case no activation, hence no dispatcher flush. You need to publish the page after XF change to get cache updated or write your own listeners.

Avatar

Level 1

We ran into a similar issue, where the fragment is used in multiple pages, obviously it's a big pain having to re-publishing all of the pages whenever the fragment is changed. Is there a config that would invalidate all of the pages whenever the fragment's updated?

Avatar

Level 2

I also recommend to use the ACS Commons flush rules. However there is subtl problem with cache invalidation levels if your the content structure of your experience fragment does not exaclty match the structure of your site. Assume you have a site structure of /content/<brand>/<region>/<language> with statfileslevel of 4 and use /content/experience-fragments/<brand>/<language> structure for your XFs. You will have a flush rule like "/content/experience-fragments/([^/]+).*=/content/$1". that means you invalidate your brand tree. The dispatcher touches the .stat files up to level 2. But since you have deeper .stat files that are not touched, the dispatcher does not really invalidates the cache of your content pages under <region>/<language>. The workaround is to list all the region-languages combinations of your site. The downside is that you have to update the flush rules everytime a new region or a new language is introduced .

Avatar

Community Advisor

Hello @rupalig70586203,

AEM does not provide out of the box solutions to flush (re-activate) pages that have a reference to the experience fragment. You need to create your own solution.

One technique can be, on a non-heavy load website, After re-publishing an experience fragment, you can contact your cloud engineering team to flush the entire cache of your website. But keep in mind, the CPU consumption of your publishers will be affected negatively, especially if you have heavy user activity at the given time.

Another technique, as a quick solution for clearing experience fragment cache, is to have the authors use the touch UI, "manage publication", to republish all pages. However, this action will also publish site pages that are currently being edited.  

Check out this website for more caching experience fragment techniques and ideas: https://sourcedcode.com/caching-experience-fragments-with-aem-sites-6-5

Avatar

Level 1

Is there any solution for this? I am facing the same issue for content fragment as well.

 

Thanks

Avatar

Employee

Hello,

 

The exact behaviour of the dispatcher in this situation will depend on your configuration:

  1. Is the dispatcher configured to use TTLs (via the `/enableTTL` setting)?
  2. Or, is it using .stat file based invalidation with a dispatcher flush agent?

In case #1 above, the time-to-live on the content in question (often set with the ACS AEM Commons Dispatcher TTL feature) will need to expire before the page will be "refetched" from the publish tier.

 

In case #2, .stat files will be "touched" in the cache (to update their last modified timestamp) when the dispatcher flush request is received. The exact stat file(s) which are touched will depend on the `/statfileslevel` configuration. A value of "1" in this case should work, but may cause additional unnecessary load on the publish tier by re-rendering pages which are otherwise unrelated to the published XF. 

 

Another approach to case #2 would be to leverage the ACS AEM Commons Dispatcher Flush Rules feature to create "smarter" flushing schemes, which could flush your HTML content at specific paths when an XF is published.

 

Avatar

Level 3

In case anyone still looking, this behavior is supported out of the box in AEM now.

 

6.5 onwards, if you activate an XF, page referencing the XF will be flushed from dispatcher.