When we think of web applications as just another "thin client", it's clear that we need more durable storage primitives than cookies and localstorage. We'll get some hands-on experience with IndexedDB, a NoSQL database that's bigger, faster, more flexible and efficient than any of the other "classic" options.
StorageService Worker Cache APIs
We'll demonstrate some typical patterns to manage cached data in a service worker that you might be familiar with.
StorageEXERCISE: Crushing Caches
We'll polish up the use of caches in our service worker, ensuring that we only discard old data when we're confident in the integrity of updated data, and that our cache logic is as simple and maintainable as possible.
IndexedDB is a transactional, versioned NoSQL database supported by all modern browsers, and it is vastly more capable compared to other alternatives for saving durable data. We'll look at the IndexedDB API, and then a small promise-based library that we can layer on top of it to make our lives easier.
StorageEXERCISE: IndedDB IDB
We'll make use of IndexedDB (via
idb) to pre-populate a collection of data in our service worker, so it is available almost instantly when our app boots on subsequent visits.
Short coffee break
StorageIndexes, Version Migration and IndexedDB 2.0
We'll dive into more advanced IndexedDb concepts, illustrating the stark difference between the comparatively primitive localStorage and cookie options. Additionally, we'll cover new features that were added to the 2.0 draft of the IndexedDb web standard in 2016, and are now available in Chrome, Safari and Firefox.
StorageEXERCISE: IndedDB 2.0 and Migrations
We'll put our newfound knowledge of IndexedDB version migrations into practice!
StorageRecap and Wrap Up
We'll quickly recap what we've covered today, and set our sights on tomorrow's topics!