Force Confluence cache to refresh from database?

Mark Maier
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 18, 2011

We want to automatically update a specific page in wiki by directly updating the record in BODYCONTENT table in database. Unfortunately the users don't see the changes after changing the database record.

I guess this has to do with the object cache in Confluence, that doesn't ask the database for changes if the object is always in cache. Is there any way to force the cache to refresh (not from admin area, but by calling something from our script that does the changes in BODYCONTENT)?

Or can I call the page with some parameter that loads the content from database instead of cache?

3 answers

1 vote
B_ Normann P_ Nielsen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 28, 2011

I do direct inject into the database at the moment, and it is realy not such a big deal - of cause there is a risk, but that is primarily when upgrading Confluence, my current injection of WIKI markup is not V4 compliant.

I stumbled across this post searching for a way to refresh the body cache, calling the URL

/admin/flushcache.action?cache=com.atlassian.confluence.core.BodyContent&redirectUrl=cachestatistics.action%3FshowDistributions%3Dfalse

will do it (similar to use the gui at /admin/cachestatistics.action?showDistributions=false - flusing the "Content Bodies")

I just nedd to find the login parameters, somethin simelar to JIRA's os_user etc...

The CLI is a great tool, but I dont want page history as several pages are updated each day, and I use the pageId for getting data in.

See my scripts at http://www.mos-eisley.dk/display/it/Confluence

1 vote
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 18, 2011

Short answer is "don't do it". You should not be even thinking about poking data into Confluence while it's running.

"Refreshing the cache" would be a nightmare that involves rewriting core code. You could do it, but you'll need to retest all sorts of stuff, persist it through upgrades and frankly, there's far better ways to approach this. The first thing to think of is abstracting the call for data from the content of your page.

I would write a macro that provides the current content from a database table outside Confluence (it can be inside the Confluence schema of course, but the point is to keep it separate and a separate table is the easiest way to do it). Before diving into that though, I'd look at https://studio.plugins.atlassian.com/wiki/display/SQL/Confluence+SQL+Plugin as that could solve the problem or at least give you a start on how to code something if it's not quite right.

0 votes
Bob Swift (personal)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 18, 2011

Or write the content legally by running storePage using Confluence Command Line Interface or similar. Then you get page history as well.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events