References
This ticket corresponds to issue 7 from #718.
That ticket was too big to tackle at once so we split it up in to smaller, more manageable chunks of work.
Description
Our attempts at abstracting away the cache has made working with it harder not easier.
Every time any component needs anything from the rest api, they call the dataservice, which creates a request object, and passes it off to the request service. The request service then checks if the thing being requested is already cached, if it is it doesn't actually send the request, but returns the cached result.
The original reason to do this was that developers should just program as if there was no cache and we'd be able to disable the cache or swap it out with a different implementation etc.
In practice it doesn't work like that at all. Every component or service that interacts with the request service has to take in to account this behavior, there are cases where we can't help but force bypass this behavior, it has led to complicated code with a bunch of edge cases, a bug chunk of memory that's needed to track all the requests that were never sent etc. We're not even close to being able to turn off the cache without breaking absolutely everything.
Proposed solution
- The requestservice will send every request it receives
- dataservices will check the cache for a valid object before sending a request
- Only if the check fails (the object isn't cached or is stale), the dataservice will send a request to the request service.
- If a certain method for a specific service never needs a cached object, it can simply leave out the check.
- We no longer need forceBypassChace, the request id mapping index, or observable.race() calls for retrieving a request which should make everything more straightforward and should improve performance.
This will take an estimated 35 - 45h
References
This ticket corresponds to issue 7 from #718.
That ticket was too big to tackle at once so we split it up in to smaller, more manageable chunks of work.
Description
Our attempts at abstracting away the cache has made working with it harder not easier.
Every time any component needs anything from the rest api, they call the dataservice, which creates a request object, and passes it off to the request service. The request service then checks if the thing being requested is already cached, if it is it doesn't actually send the request, but returns the cached result.
The original reason to do this was that developers should just program as if there was no cache and we'd be able to disable the cache or swap it out with a different implementation etc.
In practice it doesn't work like that at all. Every component or service that interacts with the request service has to take in to account this behavior, there are cases where we can't help but force bypass this behavior, it has led to complicated code with a bunch of edge cases, a bug chunk of memory that's needed to track all the requests that were never sent etc. We're not even close to being able to turn off the cache without breaking absolutely everything.
Proposed solution
This will take an estimated 35 - 45h