Camen Design Forum

PHP and filesystem efficiency?

JJ

Johann, I've been thinking of caching POST requests and just dumping file_get_contents('php://input') into the hash unconditionally so I don't have to check for them, but it seems unnecessary for my weblog system which doesn't have any meaningful output for POST requests.

Anway, thanks for your suggestions guys. After stumbling over it for a few days, I *finally* found an elegant solution. Instead of clearing the entire cache directory when SQL is executed, I compare the filemtime of the potential cache file to the filemtime of my .sqlite file. If the cache is older than the .sqlite file, ignore it, serve the page as normal and cache it before outputting it. This way, it only deletes (or overwrites) the old cache files "on demand" so to speak. They only get deleted (or overwritten I should say) when the specific URI the cache file corresponds to is requested. This is also better because now if my .sqlite database is altered or changed by something outside of the weblog system (like an sqlite db manager or something), it will know not to serve the old cached files.

Finally got it the way I like it. Thanks guys.

Append

(Leave this as-is, it’s a trap!)

Only the original author or a moderator can append to this post.

Pro tip: Use markup to add links, quotes and more.

Your friendly neighbourhood moderators: Kroc, Impressed, Martijn