Pushing cache invalidations to the CDN is now fairly common, and is a pattern that we call "event driven content" here at Fastly. But what stops us clearing content from the browser cache too, and how easy would it be to overcome those problems?
Requirements for client-side event driven caching 1 Push a server-initiated purge signal to the browser. 2 Programmatically evict an object from the browser cache.
● Event driven content ● Updating third party script libraries (Google analytics, Sentry, polyfill.io) ● Recovering from mistakes and bad deployments Use cases for client-side cache invalidation
Requirements for client-side event driven caching 1 Push a server-initiated purge signal to the browser. 2 Programmatically evict an object from the browser cache.
● Clearing the browser cache is hard ● Clear-Site-Data and cache:reload are the ‘proper’ solutions ● Until then, POST in an IFRAME is the most effective solution if you want to or need to use the HTTP cache ● Service worker cache API is much more straightforward if you are caching there ● Web Push allows proactive notification of invalidations, but still requires a visible notification Summary