diff options
| author | Michael Foster <savetheinternet@tinyboard.org> | 2013-08-29 08:07:27 +1000 |
|---|---|---|
| committer | Michael Foster <savetheinternet@tinyboard.org> | 2013-08-29 08:07:27 +1000 |
| commit | 09027cd8ae2b25b7497647e70f382f958f18e496 (patch) | |
| tree | abd283a636e1987e8791917b5e4a8150f09ab866 /inc/cache.php | |
| parent | 3b5561d1a40076121c332f9c83de0c8fafda0693 (diff) | |
Better cache debugging: Show hit/miss, etc.
Diffstat (limited to 'inc/cache.php')
| -rw-r--r-- | inc/cache.php | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/inc/cache.php b/inc/cache.php index 849748d4..fd89be13 100644 --- a/inc/cache.php +++ b/inc/cache.php @@ -60,10 +60,8 @@ class Cache { break; } - // debug - if ($data !== false && $config['debug']) { - $debug['cached'][] = $key; - } + if ($config['debug']) + $debug['cached'][] = $key . ($data === false ? ' (miss)' : ' (hit)'); return $data; } @@ -95,10 +93,13 @@ class Cache { case 'php': self::$cache[$key] = $value; break; - } + } + + if ($config['debug']) + $debug['cached'][] = $key . ' (set)'; } public static function delete($key) { - global $config; + global $config, $debug; $key = $config['cache']['prefix'] . $key; @@ -119,6 +120,9 @@ class Cache { unset(self::$cache[$key]); break; } + + if ($config['debug']) + $debug['cached'][] = $key . ' (deleted)'; } public static function flush() { global $config; |
