This is old and out-dated. Please see https://doc.replicache.dev/strategies/overview instead.
The Global Hash Strategy is relatively easy to implement and very easy to maintain.
In contrast to every other pattern presented here, no additional fields need to be added to server-side entities and no special care needs to be taken to maintain those fields. In contrast to The Last-Modified Strategy and The Global Version Strategy, no special care needs to be taken around deletes and selection changes.
The downside is that it is also the most expensive strategy in terms of database read load. Each pull request causes a full read of all of the data backing the client view.
clear
op followed by put
ops for each entry in the Client ViewThe challenge is the load on the primary database. Every pull reads all data.
A way to reduce load is to break the Client View down into more granular pieces and use some other strategy for each piece, then the hash within the piece. For example, if you are application is syncing spreadsheets, where each spreadsheet is modeled as a set of key/value pairs in the Client View, you could use The Global Version Strategy or The Row Version Strategy to track the version of each spreadsheet, and then the The Global Hash Strategy for all data within the spreadsheet.