2 ms·
The best approach is to treat it as a cache for reads. You do still need to have initialization logic to restore in-memory state from the KV store, but since th
by paulgb 3y ago
The best approach is to treat it as a cache for reads. You do still need to have initialization logic to restore in-memory state from the KV store, but since that logic isn't run on the vast majority of requests, you can afford for that initialization logic to be more expensive.
There's also plenty of state (live cursor positions, for example) that you may want to have in-memory, but you don't want to be durable. The advantage of DOs is that you get to make that choice, instead of the platform insisting that any state passed on to the next invocation be stored durably outside the process.
- chrisjj 3y agoFigures, but then the gain is just performance. Not functionality as trumpeted.