Transcript
00:00 So these requests that we're making are all hitting this mini server that we've got here in our loader. So when we search ships, this is where it goes. And we perform the search ships function on our back end, and we get our result. And then we send back a JSON stringified version of that.
00:18 And so what we're going to do is add a cache control header of 300, max age 300, that will store things in our browser for five minutes. And then we'll do the same thing for the get ship API.
00:32 And so now I'm going to do a search for star. And then I'm going to refresh and check this out. Here, let's clear out the network, do another search for star. And, man, that was fast because it's all coming from the disk cache because we told the browser, hey, could you hang on to this for like five minutes?
00:51 Our data is not likely to change that often or whatever. And so this is pretty basic. There's not really a great way to invalidate or anything with just the cache control header. There are mechanisms, but that's a whole other topic in itself.
01:06 But I just wanted to have you watch this or experience this, do this, so that you could appreciate that a lot of the performance optimizations that we can make are actually back end optimizations that you can make. And not everything needs to be cached in the client.
01:23 There's kind of give and take on both ends of that. And perhaps even if the requests that you're making are taking a long time, maybe the server just needs to optimize its own stuff so it doesn't take so long. So, yeah, there's a lot around optimization here,
01:39 and this is one of the places where it can be really useful to optimize.