Hacker News new | ask | show | jobs
by rjbond3rd 5255 days ago
Based on that example caching code (in Part 1):

> if (file_exists($file) && (filemtime($file) + $timeout) > time()) {

It would seem (at least on the surface) to be preferable (faster and simpler) to just serve static pages already, with another cron to overwrite (i.e., freshen) them periodically. That skips testing for the file's existence, the hash, time(), the comparison.

While all those (trivial) operations are no doubt lightning fast, that code is already serving static pages, so the cache seems like it has no real benefit (to me).