mirror of
https://github.com/friendica/friendica
synced 2025-04-25 02:30:11 +00:00
Fix getAllKeys() method for memcache instances
This commit is contained in:
parent
41e2031e6b
commit
e2e109b8c1
5 changed files with 108 additions and 17 deletions
|
@ -84,19 +84,19 @@ abstract class Cache implements ICache
|
|||
* Filters the keys of an array with a given prefix
|
||||
* Returns the filtered keys as an new array
|
||||
*
|
||||
* @param array $array The array, which should get filtered
|
||||
* @param array $keys The keys, which should get filtered
|
||||
* @param string|null $prefix The prefix (if null, all keys will get returned)
|
||||
*
|
||||
* @return array The filtered array with just the keys
|
||||
*/
|
||||
protected function filterArrayKeysByPrefix($array, $prefix = null)
|
||||
protected function filterArrayKeysByPrefix(array $keys, string $prefix = null)
|
||||
{
|
||||
if (empty($prefix)) {
|
||||
return array_keys($array);
|
||||
return $keys;
|
||||
} else {
|
||||
$result = [];
|
||||
|
||||
foreach (array_keys($array) as $key) {
|
||||
foreach ($keys as $key) {
|
||||
if (strpos($key, $prefix) === 0) {
|
||||
array_push($result, $key);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue