From 621bb0930371d941399bc821904f05c1bb0b242b Mon Sep 17 00:00:00 2001 From: Blastyr Date: Sun, 12 Apr 2015 03:57:38 -0400 Subject: [PATCH] Added caching debug --- stats.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/stats.php b/stats.php index 3274923..4fdaaff 100644 --- a/stats.php +++ b/stats.php @@ -2,14 +2,17 @@ define('PAGE_CACHE_EXPIRES', 10000); define('PAGE_CACHE_FILEPATH', './.cached_stats.html'); +define('PAGE_CACHE_DEBUG', false); + // Get the modification time of the cached page and // determine if it is within the expiration time $cached = filemtime(PAGE_CACHE_FILEPATH); $expired = ($cached !== false && $cached > (microtime(true) - PAGE_CACHE_EXPIRES)); if (!$expired) { +if (PAGE_CACHE_DEBUG) error_log('Serving cached stats page'); echo file_get_contents(PAGE_CACHE_FILEPATH); exit(); -} +} else if (!PAGE_CACHE_DEBUG) error_log('Generating new stats page'); ob_start();