Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

How to setup a flush agent to auto-clear dispatcher cache when I deploy/install a new package?

Avatar

Level 9

as above.

 

Basically, I want /var/www/html (or whatever is the configured Apache HTTP server home folder) to be empty.

 

scenario1: I manually installed a code (or content package) package via packMgr. I want the dispatcher cache to be cleared.

 

scenario2: I installed a code package via CI/CD.  I want the dispatcher cache to be clear.

 

I know I can manually run a curl command to invalidate dispatcher cache but I'm hoping this can be done via an agent.

 

curl -u admin:ADMIN-PASSWORD-HERE -k -H "CQ-Action: Delete" -H "Content-Length: 0" -H "Content-Type: application/octet-stream" -H "CQ-Handle: /content" https://PUBLISH-DISPATCHER-IP:PORT/dispatcher/invalidate.cache

 

 

Thank you.

1 Accepted Solution

Avatar

Correct answer by
Level 5
2 Replies

Avatar

Correct answer by
Level 5

Avatar

Community Advisor

Hi @jayv25585659 

 

Heard about about ACS Commons 'On-Deploy Scripts' ?
Reference : https://adobe-consulting-services.github.io/acs-aem-commons/features/on-deploy-scripts/index.html 

Put your cURL logic in your script and then every single time you deploy the code this script runs. However, the catch is - that the on-deploy script is not supported on AEM as a Cloud Service. If you are (by chance) using AEMaCS, then you need to think about something else.

 

Thanks

- Bilal