mirror of
https://github.com/friendica/friendica
synced 2025-04-23 11:50:12 +00:00
friendica-5847 Console Cache List command doesn't work
- Added $prefix to all CacheDriver - Moved hostname magic to CacheDriver - Added test for getAllKeys()
This commit is contained in:
parent
1551570b7f
commit
3f0f3b6ae6
15 changed files with 131 additions and 48 deletions
|
@ -51,20 +51,15 @@ class Cache extends \Friendica\BaseObject
|
|||
/**
|
||||
* @brief Returns all the cache keys sorted alphabetically
|
||||
*
|
||||
* @param string $prefix Prefix of the keys (optional)
|
||||
*
|
||||
* @return array|null Null if the driver doesn't support this feature
|
||||
*/
|
||||
public static function getAllKeys()
|
||||
public static function getAllKeys($prefix = null)
|
||||
{
|
||||
$time = microtime(true);
|
||||
|
||||
$return = self::getDriver()->getAllKeys();
|
||||
|
||||
// Keys are prefixed with the node hostname, let's remove it
|
||||
array_walk($return, function (&$value) {
|
||||
$value = preg_replace('/^' . self::getApp()->get_hostname() . ':/', '', $value);
|
||||
});
|
||||
|
||||
sort($return);
|
||||
$return = self::getDriver()->getAllKeys($prefix);
|
||||
|
||||
self::getApp()->save_timestamp($time, 'cache');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue