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

Aem Dispatcher - Delete all cache

Avatar

Level 4

Good morning,

on Aem I have a web portal with the following structure:

 

- my-project
- my-project/en
- my-project/en/page1
- my-project/en/page1/sub-page1
- my-project/en/page2
- my-project/en/page2/sub-page2

 

how can I remove the cache from the Dispatcher of the whole "web portal" and of the "clientlibs" by calling the "dispatcher / invalidate.cache" interface with the command "curl" ?

 

Thanks

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi @robertol6836527 

 

You can use the below curl command to clear the dispatcher cache.

 

curl -H "CQ-Action: Delete" -H "Content-Length: 0"  -H "Content-Type: application/octet-stream"  -H "CQ-Handle: /content/my-project http://localhost/dispatcher/invalidate.cache

curl -H "CQ-Action: Delete" -H "Content-Length: 0"  -H "Content-Type: application/octet-stream"  -H "CQ-Handle: /etc.clientlibs/my-project http://localhost/dispatcher/invalidate.cache

Regards

Jeevan

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hi @robertol6836527 

 

You can use the below curl command to clear the dispatcher cache.

 

curl -H "CQ-Action: Delete" -H "Content-Length: 0"  -H "Content-Type: application/octet-stream"  -H "CQ-Handle: /content/my-project http://localhost/dispatcher/invalidate.cache

curl -H "CQ-Action: Delete" -H "Content-Length: 0"  -H "Content-Type: application/octet-stream"  -H "CQ-Handle: /etc.clientlibs/my-project http://localhost/dispatcher/invalidate.cache

Regards

Jeevan

Avatar

Community Advisor

Hi @robertol6836527 ,

You can do it through postman. Paste the below CURL command in your curl script box of your postman and it will help.

curl -H "CQ-Action: Delete" -H "Content-Length: 0" -H "Content-Type: application/octet-stream" -H "CQ-Handle: /content/mymyproj" https://<host:port>/dispatcher/invalidate.cache

Avatar

Level 3

You could also check https://adobe-consulting-services.github.io/acs-aem-commons/features/dispatcher-flush-ui/index.html which might be useful for creating a CICD pipeline that cleans cache (we used it when we had no direct connection between CICD pipeline and dispatcher due some project limitations)