mirror of
https://github.com/vichan-devel/vichan.git
synced 2024-11-29 09:44:28 +01:00
Better cache debugging: Show hit/miss, etc.
This commit is contained in:
parent
bdc15d2869
commit
e9a44b4cda
@ -60,10 +60,8 @@ class Cache {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// debug
|
if ($config['debug'])
|
||||||
if ($data !== false && $config['debug']) {
|
$debug['cached'][] = $key . ($data === false ? ' (miss)' : ' (hit)');
|
||||||
$debug['cached'][] = $key;
|
|
||||||
}
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
@ -96,9 +94,12 @@ class Cache {
|
|||||||
self::$cache[$key] = $value;
|
self::$cache[$key] = $value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($config['debug'])
|
||||||
|
$debug['cached'][] = $key . ' (set)';
|
||||||
}
|
}
|
||||||
public static function delete($key) {
|
public static function delete($key) {
|
||||||
global $config;
|
global $config, $debug;
|
||||||
|
|
||||||
$key = $config['cache']['prefix'] . $key;
|
$key = $config['cache']['prefix'] . $key;
|
||||||
|
|
||||||
@ -119,6 +120,9 @@ class Cache {
|
|||||||
unset(self::$cache[$key]);
|
unset(self::$cache[$key]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($config['debug'])
|
||||||
|
$debug['cached'][] = $key . ' (deleted)';
|
||||||
}
|
}
|
||||||
public static function flush() {
|
public static function flush() {
|
||||||
global $config;
|
global $config;
|
||||||
|
Loading…
Reference in New Issue
Block a user