|
|
|
|
|
by ck2
5255 days ago
|
|
I think part2 is far better suited for the typical knowledge level on HN: http://www.oracle.com/technetwork/articles/dsl/white-php-par... BTW their demonstration code where they hit filemtime constant to see if a file is outdated is also a bad recommendation since there is OS overhead, especially exaggerated if you use NAS. Instead use time of day for an zero-load way to check if sometime is out of date, and only update during times of lower load. |
|
> 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).