diff --git a/inc/cache.php b/inc/cache.php
index 01a305dfa8e6f8d83bb3edf02dbf61b1e3ecd692..491fe19231b7ea4715383c69897239b0b60b0824 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));