mirror of
https://github.com/silverstripe/silverstripe-staticpublisher
synced 2024-10-22 14:05:54 +02:00
NEW Adding debug helpers for skipping cache
This commit is contained in:
parent
d53b3ad855
commit
d6d220af5c
8
main.php
8
main.php
@ -134,8 +134,8 @@ if (
|
|||||||
header("Etag: $etagFile");
|
header("Etag: $etagFile");
|
||||||
header('Cache-Control: public');
|
header('Cache-Control: public');
|
||||||
header('X-SilverStripe-Cache: hit at '.@date('r'));
|
header('X-SilverStripe-Cache: hit at '.@date('r'));
|
||||||
|
|
||||||
if (@strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE'])==$lastModified || $etagHeader == $etagFile) {
|
if (($ifModifiedSince && @strtotime($ifModifiedSince)==$lastModified) || $etagHeader == $etagFile) {
|
||||||
header("HTTP/1.1 304 Not Modified");
|
header("HTTP/1.1 304 Not Modified");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -162,6 +162,10 @@ if (
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Fall back to dynamic generation via normal routing if caching has been explicitly disabled
|
// Fall back to dynamic generation via normal routing if caching has been explicitly disabled
|
||||||
|
header('X-SilverStripe-Cache: skipped at '.@date('r'));
|
||||||
|
if ($cacheDebug) {
|
||||||
|
echo "<h1>Cache skipped</h1>";
|
||||||
|
}
|
||||||
skipCache();
|
skipCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user