summaryrefslogtreecommitdiff
path: root/inc/cache.php
diff options
context:
space:
mode:
authorBen Coburn <btcoburn@silicodon.net>2006-09-18 01:04:03 +0200
committerBen Coburn <btcoburn@silicodon.net>2006-09-18 01:04:03 +0200
commit33c1bd6185544867c19fe4067236a7d48c2400c0 (patch)
tree1e3599e896648349be4eab710797d5a089d1ec35 /inc/cache.php
parent76aa94b7af28b0321f91edc668f647cb2ff43003 (diff)
downloadrpg-33c1bd6185544867c19fe4067236a7d48c2400c0.tar.gz
rpg-33c1bd6185544867c19fe4067236a7d48c2400c0.tar.bz2
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
Diffstat (limited to 'inc/cache.php')
-rw-r--r--inc/cache.php5
1 files changed, 4 insertions, 1 deletions
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));