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.

Clear dispatcher cache programmatically from publisher in AEM 6.x

Avatar

Level 2


Hello Community.
First time here
We have a requirement in which we need to clear dispatcher cache without publishing the page. We tried flush service options but it is not working for us. Looking for solution options to achieve this.

Thank you

9 Replies

Avatar

Employee Advisor

When do you want to clear the cache programmatically? Please brief us about the event in publish instance based on that you want to clear the cache programmatically.

Avatar

Level 2

The solution is supposed to work by updating the cache often with  json-ld markup. These updates happen very dynamically and often too. Because of this, it is not feasible to publish the page manually so often. 
So, it is important that we are able to invalidate the dispatcher cache for content dynamically generated by our AEM connector. 
Did I explain clearly?

Avatar

Level 2

We have written functionality in which we receive requests (POST) from the third party to update the node data in Publisher, after updating we also need to invalidate/remove that page cache from the dispatcher.


As we are not publishing the page from Author to Publisher, we are looking for options to do it programmatically.
response...

Avatar

Employee Advisor

Understood. In that situation we can create Event handler or Event Listener which will be responsible to observe the change at node level on Publish instance.

Once it observes the change then it will clear the dispatcher cache programmatically from AEM publish instance.

 

But we need to make sure that Event Handling will work only for this use case.

You can follow this if you aren't using acs-commons.

 

Please review the section named: Example flush servlet at https://experienceleague.adobe.com/docs/experience-manager-dispatcher/using/configuring/page-invalid...

 

Avatar

Level 2

Thank you for the feedback. We will try to se what works best.