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.
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.
The following script works from Confluence 5.5 onward and flushes all the caches:
#!/bin/sh HOST=$1 USERNAME="admin" PASSWORD="xxx" 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 must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Olli,
Thanks for the very quick response
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Olli, I've tried your script but am getting this error:
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>405 Method Not Allowed</title>
</head><body>
<h1>Method Not Allowed</h1>
<p>The requested method DELETE is not allowed for the URL /rest/cacheManagement/1.0/cacheEntries.</p>
<hr>
<address>Apache/2.2.15 (Red Hat) Server at localhost Port 80</address>
</body></html>
Can you advise?
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.