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

> At the end of the day, offline-first is a whole bunch of caching, and so you end up needing to deep dive into cache invalidation strategies which we all know is a hairy problem.

Looks like you're not truly getting the concept of Offline-first apps then. You don't have or need a cache. You have a local database on the device that syncs up with the server, if online.

Conflicts can occur, but modeling data well with a CouchDB/PouchDB setup (i.e. prevent conflicts by not modifying docs all the time, rahter create new ones) + having a simple time-stamp based heuristic can already be sufficient. Otherwise, using CRDT is an option.



> You don't have or need a cache. You have a local database on the device that syncs up with the server, if online.

The source of truth is the server. Everything else (i.e. the local copy) is a snapshot of that, aka a cache. Its just that offline-first is _always_ a cache-first read, so you seem to think that this makes it not a cache any more, but a regular data store.


CRDT is really a multi-master model with eventual consistency. It's not merely a cache but also operates as a master and source of truth. With a well-built CRDT you can also skip the server and sync client-to-client where both have master copies.

The tricky part is conflict resolution.


Right, the peer-to-peer or anything with a concept of multi-master / majority is a different class of problem. I am speaking only to traditional client-server scenarios.


> so you seem to think that this makes it not a cache any more, but a regular data store.

Yes. In an true offline-first approach with CouchDB/PouchDB, the client-side database can be considered to be main data store and the Server-Side DB could just be a backup. Or it might not be needed at all/ might only be used to migrate from one device to another.

I'd say whether it's a master-slave or Multi-master model depends on the conflict resolution strategy.


That just sounds like last write wins - the first client to sync with the server is now the source of truth and other clients that were working on the same thing will get clobbered.




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

Search: