200 private links
How to cache? It depends of the context: push vs pull and owned vs user.
Push means that the asset is pushed to a central server and then distributed.
Pull means the asset is referenced and the central server has to “pull” the content.
Owned means it’s owned by the central server.
User means it’s user-submitted content.
Push + owned
Make everything push + owned content if possible. "It turns out, however, that you can make a shit ton of other stuff push + owned if you try a little harder. "
How does the client check if they're expired?
Use “stale while re-validate”. Ur welc’
In summary:
- store asset
- use stale-while-re-validate access patterns
- should work offline
Push + User & Pull + Owned
Handle these with hash URLs. Hash the URL and treat it immutably.
Push + User: Forum comment -> hash URL
Pull + Owned: "in-content" assets. That’s where it’s user generated content, but not owned by the server.
Summary:
- Load asset
- Use infinite TTL + hashed URLs
- Should not re-fetch across page/app reloads
Pull + User
That’s where it’s user generated content, but not owned by the server. Posting gifs into the chat is a prime example; linking a blog post and generating a media upload for that is another.
Guess what: this pattern fits for highly dynamic user-generated content, which means it’s the content users link to each other in-platform.
Stable URL, short TTL. YES, SHORT TTL. [...] Debounce + throttle? Sure. Micro-TTL? Yes. Cache? Never.