Updating Cached Files
Understand how to update files already stored in the app's cache storage.
We'll cover the following
We need to make changes to the app during development and after deployment. Then how can we update the static files we cache during pre-caching and force the browsers to cache and use the latest files?
The browser won’t update the static cache by updating just our static files and not updating the service worker. This is because we use the service worker to cache the static files. For every page request, if we first look in the cache, the browser will continue to serve the user with the outdated cached content without reaching the server.
Pre-caching is implemented during the install
event, which is fired only once for each new service worker. So if we don’t change the service worker code, the browser will not update it, no pre-caching will occur, and the browser will keep the outdated assets in the cache storage.
Get hands-on with 1200+ tech skills courses.