JD_Toims - 4:12 am on Aug 24, 2013 (gmt 0)
.htaccess => run PHP script to check if page exists => serve cached page, OR
.htaccess => run PHP script to check if page exists => run PHP script to create page
Just to make sure it's clear:
This is not exactly what I outlined does.
What I outlined [minus the capitalization correction] is:
.haccess => Immediate rewrite to PHP [we know the PHP file exists] => Single PHP check for the requested file [no extra code, file path walk or disk scan invoked] => Serves the file's contents or *includes* a single PHP file [we know it exists -- again, no extra code, file path walk or disk scan invoked] and the *included* file creates the page, then serves it's contents, then saves the page [saving comes after serving it to the visitor] or it serves a 404 error.
Added Note: One thing to keep in mind on this type of system is the more a file is used the closer it's "pushed to the front of the server cache", even on shared hosting, so I personally want a single file used as much as I can use it, because if it's used enough it'll be cached in RAM rather than loaded from the hard-disk and a file cached in RAM makes it *screaming fast* for the server to use.