How to flush Confluence cache from the command line, without restarting Confluence?

I am looking for a solution to flush Confluence cache without restarting the service.

It has to be a scriptable solution, one that I can include inside a script.

6 answers

1 accepted

If you mean Confluence plugin cache. The cache are used to keep frequently used information handy. If you clear it without restarting Confluence, that will make some plugins fail.

If you mean Conflnuence cache, you can flush it from the user interface in "Confluence Admin" > "Cache Statistics" but unfortunately there is not a method in the API for this so I don't think it can be easily scripted.

2 votes

The following script works from Confluence 5.5 onward and flushes all the caches:



JSESSIONID=`curl --cookie-jar - --data "os_username=$USERNAME&os_password=$PASSWORD" "$HOST/dologin.action" | grep JSESSIONID | awk '{ print $7 }'`
curl --cookie JSESSIONID=$JSESSIONID --request DELETE "$HOST/rest/cacheManagement/1.0/cacheEntries"

You could write a command line script to access the Admin screen llinks mentioned by Alex using curl or something. You can pass credentials in at the command line to authenticated...though you'll have to circumnavigate the second admin login.

Olli, I've tried your script but am getting this error:

<title>405 Method Not Allowed</title>
<h1>Method Not Allowed</h1>
<p>The requested method DELETE is not allowed for the URL /rest/cacheManagement/1.0/cacheEntries.</p>
<address>Apache/2.2.15 (Red Hat) Server at localhost Port 80</address>


Can you advise?


0 votes

Hi Shay,

You seem to get that error from an Apache instance that is sitting in front of your Confluence instance. You would have to ask the administrator of that instance why it is blocking your DELETE request.

Hi Olli,

Thanks for the very quick response smile

My problem turned out to be the fact I gave the hostname as just "HOST" parameter as just the hostname (MYSERVER) and not the http address to Confluence (http://MYSERVER:8090).


Thanks again!

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Feb 06, 2019 in Confluence

Try out the new editing experience

Hi team, I’m Avinoam, a product manager on Confluence Cloud, and today I’m really excited to let the Community know that all customers can now try out the new editing experience and see some of the ...

1,465 views 114 8
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you