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

This widget could not be displayed.

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.

This widget could not be displayed.

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

This widget could not be displayed.

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
Community showcase
Posted Sep 17, 2018 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...

583 views 7 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