jira-tools icon indicating copy to clipboard operation
jira-tools copied to clipboard

Use Cache Service for frequent API call with infrequently changed data

Open ljay79 opened this issue 7 years ago • 5 comments

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

ljay79 avatar Aug 05 '17 11:08 ljay79

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.

paul-lemon avatar Jan 31 '19 21:01 paul-lemon

Yep, one approach... for all this i first need a handy Storage class to handle all different pruposes conviniently...

ljay79 avatar Jan 31 '19 21:01 ljay79

^ @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.

paul-lemon avatar Mar 05 '19 21:03 paul-lemon

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.

ljay79 avatar Mar 06 '19 11:03 ljay79

I think it may be needed sooner rather than later for some calls but agree its not needed right now.

Reasons its needed.

  1. Some calls are expensive on JIRA (get all fields) but change infrequently (get all fields)
  2. Those slow calls also affect user experience (they have to wait for the screen to appear) - that makes the product feel clunky
  3. 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 .

paul-lemon avatar Mar 06 '19 12:03 paul-lemon