 Hi, my name is Adriana Jara and today in unpacking the word box we're going to go over word box caching strategies and learning how to cache your static assets with only one line of code. In a previous video I went over different types of caching, pre caching, runtime caching, and a warm cache strategy. You can review those concepts with the link in the description. In this video I'll go over the different cache strategies you get out of the box with word box and how with a line of code you can implement a cache for your static assets with a word box recipe. In case you're not familiar with word box it is a set of tools developed to make the implementation of service workers easier. If you're not familiar with service workers you can check their documentation on this page. The service worker acts as an intermediary. Our app gives the service worker requests and the service worker decides where to get the response from and gives our app the response back. Word box has word box routing to be able to identify a group of requests to then use word box strategies to tell the service worker what to do to get the response for that group of requests. The purpose of the method register route is to give the service worker a way to identify these requests with this route and when you find them respond with this strategy. In this verbose example we pass a way to identify requests for images and tell the service worker to respond with a cache first strategy. I'm explaining what the different cache strategies that are available out of the box with word box. The one in the example is cache first. The way this strategy works is if there is a response in the cache the request will be fulfilled using the cached response and the network will not be used at all but if there is in a cached response the request will be fulfilled by the network and the response will be cached so that the next request will use the version from the cache. It is particularly useful for assets that are non-critical and can be gradually cached. Next we have the network first. It is an idea solution for requests that are updating frequently. By default it will try to fetch the latest response from the network. If the request is successful it will put the response in the cache. If the network fails to return a response the cached response will be used. We also have the stable revalidated strategy. It allows you to respond to the request as quickly as possible with a cached response if available falling back to the network request if it is not cached. The network request is then used to update the cache. As opposed to some implementation of a stable revalidate this strategy will always make a revalidation request regardless of the age of the cached response. This is a fairly common strategy where having the most up-to-date resource is not vital for the application. Finally we have the network only and cache only strategies. Network only is used for requests that you must get fresh from the network every time. The cache only strategy will never go to the network for a response. It is not a common in Wordbox but if you saw the previous video it can be used to implement your own pre-cache. Now you know what options are available for serving your different resources. Let's check out a couple of ways to implement a cache for static resources. This cache is specific for CSS, JavaScript and worker files. We'll deal with images in the next video. Here is the longer version to implement our cache. We create a method that identifies the types of requests handled by this pattern. In this case we'll use our stable revalidate strategy to prioritize the speed of response over serving the very latest version. And we register the route so Wordbox knows this is what we want to do with those assets. Writing this code is not a bad but we've seen this pattern repeated enough times that we decided to make it as easy as one line. Without any options that one line is equivalent to the long version but you can pass options to that method and change the cache name or the callback to choose how to identify your static assets. Check out the options available on this URL. Saying the caching is complex is an understatement but Wordbox provides strategies out of the box that allow you to focus on choosing the strategies that best meet your needs instead of repeating common patterns. You can even cache your static assets with one line. Wordbox also gives you the flexibility to create your own caching strategy. Check out the Wordbox documentation for more information here. You can subscribe for more developer news and tips. Your comments and questions below are welcome. Thank you. Until next time.