TruBudget icon indicating copy to clipboard operation
TruBudget copied to clipboard

api: re-implement cache with node-cache to add ttl for cache entities

Open mayrmartin opened this issue 2 years ago • 2 comments

Checklist

  • [x] I have followed (at least) the PR section of the contributing guide.
  • [x] I fixed all necessary PR warnings
  • [x] The commit history is clean
  • [x] The E2E tests are passing
  • [x] If possible, the issue has been divided into more subtasks
  • [x] I did a self review before requesting a review from another team member

Description

Solves API-Heap problems by adding a TTL for cache entities

Closes #1108

mayrmartin avatar Aug 23 '22 13:08 mayrmartin

Warnings
:warning: No CHANGELOG added.

Generated by :no_entry_sign: dangerJS against b586f9b4ac94777901e6f91407886a280ab8a340

github-actions[bot] avatar Aug 23 '22 13:08 github-actions[bot]

NotesTime
:x:Note for Reviewer: E2E tests on remote server failedWed, 07 Sep 2022 08:41:28 +0000

Generated by E2E-Test

openkfwCI avatar Aug 23 '22 14:08 openkfwCI

This PR introduces a time to live for the cache - 10 mins. Every 10 mins the cache is cleared, after which a new request to the api (that uses the withCache()) function will trigger the cache to reload. Our purpose was to help with the api heap problems (issue #1108), however only a ttl does not fix the problem, because the cache is still filled again on a new request after it is cleared.

In order to fix the issue, we need to improve the caching startegy overall, which will be discussed in a separate discussion #1290

This PR will be closed and after the discussion is finished we hope to fix this issue with a new PR

georgimld avatar Sep 08 '22 13:09 georgimld