During development, it is often needed a quick way to clear dispatcher cache. In this article, I am going to enlist basic methods:
curl -H "CQ-Action: Delete" -H "Content-Length: 0" -H "Content-Type: application/octet-stream" -H "CQ-Handle: /content/mymyproj" 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/myproj" http://localhost/dispatcher/invalidate.cache
In above commands:
Other tools like postman can be used too for this purpose. Just hit the rest end point with required parameters as passed in the curl command above.
1. curl command/ script
You can run the below curl command-curl -H "CQ-Action: Delete" -H "Content-Length: 0"
curl -H "CQ-Action: Delete" -H "Content-Length: 0"
In above commands:
- Replace the "localhost" with correct dispatcher server URL. You can get the URL from the flush agent transport URL. Use the public URL/ IP of the dispatcher or make sure you are connected to relevant VPN. Or make sure your machine IP is white-listed by the dispatcher to allow you direct access. If proxy information is available then you can pass it to curl command.
- If your dispatcher is on https and the command gives error relate to SSL certificate. Then ignore the ssl certificate warning by using "-k" argument to the curl command.
Also you can run these commands as a batch file in bat script for windows and sh script for Linux/ Mac. An example file-
2. Jenkin Job
The same can be achieved through a Jenkin job. To the build step- Add a "Execute Shell" step. Here paste the same curl command.Other tools like postman can be used too for this purpose. Just hit the rest end point with required parameters as passed in the curl command above.
No comments:
Post a Comment