 Making your web app work offline is slowly becoming more of an expectation than just a feature. Every app is different and there's many different caching strategies for the different situations. But one of the simplest and most versatile caching strategies is stale while revalidate. With this caching strategy, a request will always use the cached response if there is one, regardless of whether it is stale or not. In the background, we can hit the server and update the cache if necessary. If an update was necessary, you can decide whether to prompt the user to reload the page depending on how important the freshness of the resource is. So let's take a look at how we can implement this caching strategy in our service worker. Whenever a request comes in, we consult both the cache and the network. We want to respond with something as quickly as possible, so for our respond with function, we use the cached response if available. If there was nothing in the cache, we use the network's response. And if that isn't available either, we can't do much more than throw an error. This way, we're making sure the browser gets something to work with as quickly as possible. The resource revalidation goes into our wait until function. It's fine if this process takes a little bit longer as it will be running in the background and won't stale other responses. And we are already done. This is an excellent caching strategy for blocks and similar contentful websites. Just make sure your caching headers and your e-tags are set correctly so the revalidation doesn't become too costly. Thanks for watching. Thank you for sticking around. Since you made it to the end card, I might as well ask you to click our big crew... Oh, it's over here.