How to automate cache refresh -7.x


Using the cache macro really improves display performance for viewers of the page. At some point, the cache will expire and will need to be refreshed. The first viewer to access the page after expiry will have to wait. To avoid this so that every page view is quick, you can automate the cache refresh. This describes the steps necessary to do this. This support is based on the refresh=true request parameter that is supported by the Cache macro to refresh all cache macros found on the page.


  1. Determine the appropriate refresh intervals for each of the pages you need to automate. For example, I have used the following categories: 15m1h3h24h.
  2. Make up label names that correspond to the categories. For example, cache_15mcache_1hcache_3hcache_24h.
  3. Add one of the labels to each of the pages that need to be automated.
  4. Make sure the refresh time parameter for each cache macro is longer than the automated time to allow the automation to refresh the page before a viewer hits the page.
  5. Add the following Confluence Command Line Interface (CLI) action to your favorite job scheduler - one for each category determined above. 

    --action runFromPageList --labels cache_15m --common "-a renderRequest --requestParameters refresh=true --title @home --space experiment --file \"\" "


It is even better if you have Bamboo already or install a simple Bamboo server to run the automation. In this case, the Run CLI Actions in Bamboo can be used. It provides a Confluence CLI task that can run the action mentioned above. Schedule a build (one for each category) on the schedule corresponding to the category.