Force Confluence cache to refresh from database?

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

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.

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

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
Atlassian Community Anniversary

Happy Anniversary, Atlassian Community!

This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.

Read more
Community showcase
Kesha Thillainayagam
Posted Apr 13, 2018 in Confluence

We want to hear how your non-technical teams are using Confluence!

Hi Community! Kesha (kay-sha) from the Confluence marketing team here! Can you share stories with us on how your non-technical (think Marketing, Sales, HR, legal, etc.) teams are using Confluen...

1,233 views 23 10
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