From the course: Improving Performance with IndexedDB and Caching
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Challenge: Keep your data up to date - JavaScript Tutorial
From the course: Improving Performance with IndexedDB and Caching
Challenge: Keep your data up to date
(upbeat music) - [Instructor] Now that we have our data stored in IndexedDB and being retrieved, we need to ensure we keep it up to date. For this challenge, you're going to create a new object store. Inside this store, we're going to store the timestamp that each of the other stores was last updated. This way, we can set an expiry time for our data, after which we can check for an update. Depending on the data that you're working with and how often it is likely to update, the amount of time you want to allow before your data expires will change. For this challenge, let's use 30 minutes. You may want to reduce that time when testing. So what we want to do is first of all, grab the data as normal and store it. At the same time, we want to store the timestamp of when we fetched the data. On the next request, we want to grab the current timestamp and compare it to the one we stored the first time around. If the first…
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
-
-
-
-
-
What is IndexedDB?1m 9s
-
Data storage strategies50s
-
Introduction to IndexedDB1m 24s
-
IndexedDB libraries2m 45s
-
Creating a database in IndexedDB1m 1s
-
Storing data in IndexedDB1m 31s
-
Retrieving and updating data36s
-
Storing data from UI JavaScript9m 32s
-
Storing data from a service worker7m 56s
-
Retrieving stored data6m 13s
-
Challenge: Keep your data up to date1m 1s
-
Solution: Keep your data up to date6m 53s
-
Profiling1m 56s
-
Replacing your back end2m 8s
-
-