From the course: JavaScript: Service Workers
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Keep your storage clean - JavaScript Tutorial
From the course: JavaScript: Service Workers
Keep your storage clean
- [Instructor] When we are working with service workers and application cache, we know that sometimes we want to change the list of files that we are caching. In the previous video, we have added, for example, offline.json. What happens if the user already has the service worker and the package? It's not going to download that file because the service worker was already installed. So, for that typically we also need to change the version number, that's typically a good idea to change the version number in the name of the cache, so now if I go back to the browser, and refresh, we need to make sure that we are online, when we look at the Cache Storage, we have now v1 and v2, so we have the same assets twice and that may be a problem if in the future we have version 10. How do we know how many versions the user has in the storage and those folders are currently in the space of user's device? We have duplicated data. So, we need to make sure to clean previous versions of cache storages…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Understand the new Cache API5m 36s
-
(Locked)
Prepare the project4m 30s
-
(Locked)
Prefetch files on install5m 1s
-
(Locked)
Visualize your cache3m 37s
-
(Locked)
Implement a cache-first policy6m 12s
-
(Locked)
Implement a network-first policy5m 10s
-
(Locked)
Cache new elements after install5m 41s
-
(Locked)
Use stale-while-revalidate6m 46s
-
(Locked)
Deliver alternate content when offline6m 28s
-
(Locked)
Keep your storage clean5m 28s
-
(Locked)
Summary of cache strategies4m 36s
-
-
-
-