Funky caching explained
16th November 2002
I didn’t take much notice of “funky caching” while reading through Rasmus Lerdorf’s PHP tips and tricks presentation—I saw that it was talking about using custom 404 pages to serve up dynamic content depending on the URL and wrote it off as a hack that, while useful, was fundamentally flawed in that it would add an error log entry whenever a page was served.
It seems I was mistaken. Phil Ringnalda has explained the concept in more detail, and it’s actually a very clever angle on the caching problem. Rather than building content in advanced (the “baked” method, used by Moveable Type) or generating the page dynamically each time (the “fried” method, used by my weblog) you set up a custom 404 script which decides whether or not the requested content should exist when it is called. If the content is meant to be there, it creates the content, serves it up and saves it to the file system (so future requests will get the file rather than a 404). To regenerate content you just delete the static file and wait for someone to request it, at which point it will be rebuilt by the 404 script. Clever stuff.
More recent articles
- Gemini 2.0 Flash: An outstanding multi-modal LLM with a sci-fi streaming mode - 11th December 2024
- ChatGPT Canvas can make API requests now, but it's complicated - 10th December 2024
- I can now run a GPT-4 class model on my laptop - 9th December 2024