5 ms·
How does caching work in this scenario? Caching REST responses is fairly straightforward but caching arbitrarily complex queries to a single endpoint seems much
by cageface 11y ago
How does caching work in this scenario? Caching REST responses is fairly straightforward but caching arbitrarily complex queries to a single endpoint seems much more difficult.
Sorry if he answers this in his talk. I haven't had a chance to watch it yet.
- hcarvalhoalves 11y agoThe caching happens at the "DB" level, where it can happen more efficiently (e.g., Datomic caches segments on peers).
- lewisl9029 11y agoI'm not familiar with the approach either, but the video mentioned that you would mainly execute these queries using a client side library. The library would be backend agnostic, and offer remote sync capabilities. So I believe you can set the primary backend for the library to a local, in-memory data-structure to serve as the local cache, and have the library handle synchronization between the local cache and a remote backend that can also execute these queries.
- i_s 11y agoYou have to implement it yourself. For some apps, you may need to do this anyway for perf reasons, because you don't want to parse the same HTTP response body more than once.
- fnordsensei 11y agoOne solution is to not cache queries, but cache data, as in the case with Datomic.
- drcode 11y agoOf course then you're sacrificing some of the authentication, potentially.
- sgrove 11y agoIt's worthwhile watching Nubank's talk on how they manage these things with Datomic on the backend [0] - providing a "complete" (filtered) database to the client, http caches for queries based on tx-time, and syncing mobiles data via transactions-since. Takes care of said concerns nicely - I'm just implementing this stuff today however, so I'm not sure how well it'll work in practice. [0] - https://www.youtube.com/watch?v=7lm3K8zVOdY https://www.youtube.com/watch?v=7lm3K8zVOdY