mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-27 17:00:52 +01:00
Better cache debugging: Show hit/miss, etc.
This commit is contained in:
parent
3b5561d1a4
commit
09027cd8ae
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user