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

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.pngscript-editor.png

Thank you,
Erik Macias

0 answers

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events