From 33c1bd6185544867c19fe4067236a7d48c2400c0 Mon Sep 17 00:00:00 2001 From: Ben Coburn <btcoburn@silicodon.net> Date: Mon, 18 Sep 2006 01:04:03 +0200 Subject: [PATCH] Store cache hits only while debugging Reduce overhead by only storing cache hit stats while the allowdebug option is enabled. darcs-hash:20060917230403-05dcb-92afea926b5a3fc302327f964e482787aec2d982.gz --- inc/cache.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inc/cache.php b/inc/cache.php index 01a305dfa..491fe1923 100644 --- a/inc/cache.php +++ b/inc/cache.php @@ -118,7 +118,8 @@ class cache { } /** - * record cache hits statistics + * Record cache hits statistics. + * (Only when debugging allowed, to reduce overhead.) * * @param bool $success result of this cache use attempt * @return bool pass-thru $success value @@ -128,6 +129,8 @@ class cache { static $stats = NULL; static $file; + if (!$conf['allowdebug']) { return $success; } + if (is_null($stats)) { $file = $conf['cachedir'].'/cache_stats.txt'; $lines = explode("\n",io_readFile($file)); -- GitLab