* HTTP_ConditionalGet::check($updateTime, true); // exits if client has cache * echo $content; *
* $content = getContentFromDB(); * $cg = new HTTP_ConditionalGet(array( * 'contentHash' => md5($content) * )); * $cg->sendHeaders(); * if ($cg->cacheIsValid) { * exit(); * } * echo $content; *
* // before content * $cg = new HTTP_ConditionalGet(array( * 'lastUpdateTime' => max( * filemtime(__FILE__) * ,filemtime('/path/to/header.inc') * ,filemtime('/path/to/footer.inc') * ) * )); * $cg->sendHeaders(); * if ($cg->cacheIsValid) { * exit(); * } *
* array( * 'Cache-Control' => 'max-age=0, public' * ,'ETag' => '"foobar"' * ) *
* header('Expires: ' . HTTP_ConditionalGet::gmtdate($time)); *