[windup-dev] Caching - global or vertex only? And what to cache?

Ondrej Zizka ozizka at redhat.com
Wed Dec 14 05:03:07 EST 2016


Hi team,

regarding graph REST HTTP requests caching - should it be global or 
rather per-vertex (per-model)?
I started coding a global solution. If another model needs the same 
data, it will request from the same URL. I see no reason not to return 
the same object.


Another question is what to cache. Due to how it's currently done, the 
getter is supposed to return Observable<...Model>. There are these options:

1) To cache an Observable which will wrap HTTP Observable. I don't know 
yet whether this will cause re-sending HTTP request for another 
subscriber. It will solve the Angular's change scanning, though, which 
is the bigger problem. Also,  RxJS's cache() operator could be used to 
cache the HTTP response internally.

2) It can also resolve the Observable chain, and store the result into 
the cache asynchronously.
     So - when Angular would ask soon after, it would result in another 
request (maybe?); when called later, it would return the already 
available cached result.
     This would reduce the HTTP requests,  but would not necessarily 
solve the Angular change scanning.

3) A combination of 1) and 2), which would cache
      * the Observables from 1) internally, so that the getter gets the 
same object each time,
      * the results from 2) so that the subsequent requests to the same 
URL don't generate another HTTP request, with some timeout so the page 
won't get staled.
      This one is a bit complicated but I think with some RxJS magic it 
can be done.

Ondra

-- 
--
Ondrej Zizka, Windup project, Brno



More information about the windup-dev mailing list