Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



I'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.


The caching happens at the "DB" level, where it can happen more efficiently (e.g., Datomic caches segments on peers).


You 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.


One solution is to not cache queries, but cache data, as in the case with Datomic.


Of course then you're sacrificing some of the authentication, potentially.


It'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




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: