Caching is hard. So hard. But also, we are so fucking bad at it. Every time I have to use a public wifi setup I have a joker moment. Does absolutely nobody test shit on anything less than wired symmetric gigabit anymore?
Web SPA apps are some of the worst for this. Motherfucker, you have the same fucking iconography for three years, why does it load correctly and then ALL OF THE ICONS FAIL ONCE I DROP TO A SHIT INTERNET CONNECTION?!
But seriously, caching is hard, it’s really hard, but you can make life WAY easier for yourselves when building an SPA if you do this super simple thing.
I’m making up terminology but fuck it, I’m drinking coffee and eating my donut and doing this live at a coffee donut shop, so bite me. 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.
Every content caching strategy on the web (and most non-web stuff too, tbh) fucks this up because the web isn’t designed to handle this notion of push vs pull or user vs owned. However, the web is designed extraordinarily well to handle the concept of pull + owned, and with service workers, it’s also extremely equipped to handle push + owned. Mobile apps and other non-web stuff is also designed to handle push + owned extremely well, so it’s even more disappointing how bad things have gotten with this lately.