diff --git a/.github/workflows/testsv2.yml b/.github/workflows/testsv2.yml index 98679d44..103fff81 100644 --- a/.github/workflows/testsv2.yml +++ b/.github/workflows/testsv2.yml @@ -7,7 +7,7 @@ jobs: timeout-minutes: 60 strategy: matrix: - operating-system: [ubuntu-latest] + operating-system: [ubuntu-22.04] php-versions: ['8.0', '8.1', '8.2', '8.3'] name: PHP ${{ matrix.php-versions }} quality/tests on ${{ matrix.operating-system }} env: diff --git a/lib/Phpfastcache/Drivers/Redis/Driver.php b/lib/Phpfastcache/Drivers/Redis/Driver.php index 49d5e21f..8a24d311 100644 --- a/lib/Phpfastcache/Drivers/Redis/Driver.php +++ b/lib/Phpfastcache/Drivers/Redis/Driver.php @@ -125,13 +125,15 @@ protected function driverConnect(): bool */ protected function driverReadAllKeys(string $pattern = '*'): iterable { - $i = -1; - $keys = $this->instance->scan($i, $pattern === '' ? '*' : $pattern, ExtendedCacheItemPoolInterface::MAX_ALL_KEYS_COUNT); - if (is_iterable($keys)) { - return $keys; - } else { - return []; - } + $i = null; + $pattern = $pattern === '' ? '*' : $pattern; + do { + $keys[] = $this->instance->scan($i, $pattern); + if (\count($keys) > ExtendedCacheItemPoolInterface::MAX_ALL_KEYS_COUNT) { + break; + } + } while ($i > 0); + return \array_merge([], ...$keys); } /** diff --git a/lib/Phpfastcache/Drivers/Rediscluster/Driver.php b/lib/Phpfastcache/Drivers/Rediscluster/Driver.php index 54b8afb0..d791201c 100644 --- a/lib/Phpfastcache/Drivers/Rediscluster/Driver.php +++ b/lib/Phpfastcache/Drivers/Rediscluster/Driver.php @@ -62,7 +62,8 @@ public function getStats(): DriverStatistic trim(<<instance->_masters() as $master) { - $i = -1; - $result = $this->instance->scan( - $i, - $master, - $pattern === '' ? '*' : $pattern, - ExtendedCacheItemPoolInterface::MAX_ALL_KEYS_COUNT - ); - if (is_array($result)) { - $keys[] = $result; - } + $i = 0; + $pattern = $pattern === '' ? '*' : $pattern; + do { + $result[] = $this->instance->scan($i, $master, $pattern); + if (\count($result) > ExtendedCacheItemPoolInterface::MAX_ALL_KEYS_COUNT) { + break; + } + } while ($i > 0); } - - return array_unique(array_merge(...$keys)); + return array_unique(\array_merge(...$result)); } /**