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

This widget could not be displayed.

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.

This widget could not be displayed.

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"

This widget could not be displayed.

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.

This widget could not be displayed.

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?


This widget could not be displayed.

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.

This widget could not be displayed.

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 Monday in Confluence

Why start from scratch? Introducing four new templates for Confluence Cloud

Hi my Community friends!  For those who don't know me, I'm a product marketer on the Confluence Cloud team - nice to meet you! For those of you who do, you know that I've been all up in your Co...

370 views 2 6
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