mirror of
https://github.com/friendica/friendica
synced 2025-04-22 17:10:11 +00:00
Add ICacheDriver->getAllKeys method
This commit is contained in:
parent
640f76b05a
commit
71c08a044f
7 changed files with 86 additions and 0 deletions
|
@ -46,6 +46,29 @@ class Cache extends \Friendica\BaseObject
|
|||
return self::$driver;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns all the cache keys sorted alphabetically
|
||||
*
|
||||
* @return array|null Null if the driver doesn't support this feature
|
||||
*/
|
||||
public static function getAllKeys()
|
||||
{
|
||||
$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);
|
||||
|
||||
self::getApp()->save_timestamp($time, 'cache');
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Fetch cached data according to the key
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue