Python Web Apps that Fly with CDNs Transcripts
Chapter: Troubleshooting
Lecture: Purge the cache

Login or purchase this course to watch this video and the rest of the course contents.
0:00 We talked a lot about avoiding cache staleness, and that works really, really well.
0:09 But maybe there's some times where you can't actually control what query string gets put onto a particular file somehow.
0:17 Maybe it's out of like a storage zone and you don't have control over it or it's getting linked to other ways, and that is stale.
0:26 So you've got a couple of options to solve those types of problems and you can just purge
0:31 the cache and you can do this aggressively or you can do this gently.
0:36 So for example, if you go to your pull zone in this example, we have the video collector, the static URL origin pull zone that we've been working with.
0:46 And if we want, we can just click here and it'll say purge the cache. We'll get a warning at least. So that's really nice.
0:53 Hold on, hold on, you're going to do an absolute dump of all the 114 POPs, points of presence throughout the world
1:02 that may have replicated anything from you. We're just gonna do a global delete, globally, I guess. You can say yes or no, do that or don't do that.
1:12 All right, so here's a really aggressive like, just remove everything, start over. Of course, the requests will then have to come back
1:20 to your server that might put some load on it or a lot depending on how much but honestly it's probably not a lot because you might
1:27 have origin shield turned on so like you hit one request and then off it goes.
1:31 I don't know your situation but chances are this is something you could do it wouldn't be terrible. It's not anything I've ever done.
1:38 I've never needed to do this but it it will wipe things out. You can be a little bit more specific or a little more cautious and this I have done
1:48 before. And you go on this left nav bar and go to purge right there. And it says enter
1:56 a particular URL to a file or you can put some kind of wildcard value like /CSS
2:04 /star and say I just want to clear out all the CSS files or all the images under some subcategory.
2:13 You would type those in here, including the URL, the actual CDN URL that you're using /the static file path, as you can see in the example here.
2:26 Then you hit this and whoosh, some small subset is gone. I've done this where there was a video course we updated.
2:35 A bunch of the files needed to be changed, but we didn't go and change all the file names in the database or particularly pass that information along.
2:46 We just said, "The URL that maps all the videos in this particular course, hit it. Wipe those away," and that worked perfectly.
2:54 Here's a more gentle way to purge the cache.


Talk Python's Mastodon Michael Kennedy's Mastodon