Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Use atlassian-cache in Confluence Scriptrunner macros

Erik Macias
Contributor
June 4, 2020 edited

Hi All,

tl;dr: How to use atlassian-cache/appears to not be working

I am using Scriptrunner in Confluence to create a macro that performs a GET REST call. Depending on the request, the response can take multiple seconds. To handle these requests, I am considering  to use caching. 

Following this post here, I learned about the altassian-caching API. However, as was mentioned in the post, it appears as if the values I wish to cache are not cached as expected. What appears to be happening on each refresh of the confluence page where my macro resides (as well as via the script console), is that the cache is empty, then the data is stored in the cache, but doesn't persist. 

For reference, I am attaching two screen shots. The first screen shot (script-console.png), at the bottom under "logs", I see that the first log ("before") is empty, and the second ("after") contains a value. This is the case on every run despite the cache being initialized with a 30 min expiration.

The second screen shot (script-editor.png), shows the cache initialization (line 28), and lines 55, 57 show the lines that printed the logs from the first screen shot. 

Just to reiterate, the same logs are seen on atlassian-confluence.log when refreshing the confluence page where the macro resides. Is this to be expected? How can I have the cache remain persistent (have the "before" log not be empty)?

 

script-console.png script-editor.png

Thank you,
Erik Macias

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
atlassian, atlassian government cloud, fedramp, webinar, register for webinar, atlassian cloud webinar, fedramp moderate offering, work faster with cloud

Unlocking the future with Atlassian Government Cloud ☁️

Atlassian Government Cloud has achieved FedRAMP Authorization at the Moderate level! Join our webinar to learn how you can accelerate mission success and move work forward faster in cloud, all while ensuring your critical data is secure.

Register Now
AUG Leaders

Atlassian Community Events