jira-tools
jira-tools copied to clipboard
Use Cache Service for frequent API call with infrequently changed data
Improve the multiple calls to fetch infrequently changed Jira data with Google Cache Service. Ie:
- For fetching all users, groups from JIRA
- Store results (jira issue filter etc) for some amount of time (<5min) to speed up creating multiple sheets with same requests/searches
- worklog generation
https://developers.google.com/apps-script/reference/cache/cache
This could be neatly achieved in jiraApi adding a cachetime property for methods which should be cached e.g.
'field' : {method: '/field', cachetime: 1000}
this would then be implemented that any call to 'field' would be cached in the google cache for 1000ms (or whatever value was set)
any method which doesnt have a cache time would not use the cache.
Yep, one approach... for all this i first need a handy Storage class to handle all different pruposes conviniently...
^ @ljay79 - should we do this? I want to add caching to the method to getAllFields. I think it could be cached for 10-20 minutes. It would speed up the UI and help cut done on a few calls. Adding it here is just as much work as anywhere else in the codebase for this call and it can then be used on other calls as and when needed by setting a cache time. Default would be for no caching. I can knock this out quite quickly.
Not sure atm.. I would prefer getting exiting W-I-P finished first to add another feature branch which requires quite some refactoring across all places.
For the API Cache specifically, it would require some thoughts into it first:
- is it actually necessary at all? :)
- what is a good cache time? (to low = no effect; to high = negative sideeffects for heavy users...) ...
If thats ok, please keep that issue open for (far) later.
I think it may be needed sooner rather than later for some calls but agree its not needed right now.
Reasons its needed.
- Some calls are expensive on JIRA (get all fields) but change infrequently (get all fields)
- Those slow calls also affect user experience (they have to wait for the screen to appear) - that makes the product feel clunky
- There is a quota on calls.
I think this is about 10 lines of code with about 20-30 to write tests.
Paul
On Wed, Mar 6, 2019 at 12:49 PM Jens [email protected] wrote:
Not sure atm.. I would prefer getting exiting W-I-P finished first to add another feature branch which requires quite some refactoring across all places.
For the API Cache specifically, it would require some thoughts into it first:
- is it actually necessary at all? :)
- what is a good cache time? (to low = no effect; to high = negative sideeffects for heavy users...) ...
If thats ok, please keep that issue open for (far) later.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/ljay79/jira-tools/issues/21#issuecomment-470078647, or mute the thread https://github.com/notifications/unsubscribe-auth/AC0YXB6BmXEA7C-2VFYJGYmH-LTmmxi4ks5vT6tVgaJpZM4OucIc .