Merge branch '4.4' into 5.2

* 4.4:
  [Cache] Add server-commands support for Predis Replication Environments
  Speedup psalm
This commit is contained in:
Nicolas Grekas 2021-02-26 00:54:56 +01:00
commit 2068652fc9
7 changed files with 277 additions and 291 deletions

View File

@ -1,47 +1,50 @@
name: Intl data tests name: Intl data tests
on: on:
push: push:
paths: paths:
- 'src/Symfony/Component/Intl/Resources/data/**' - 'src/Symfony/Component/Intl/Resources/data/**'
pull_request: pull_request:
paths: paths:
- 'src/Symfony/Component/Intl/Resources/data/**' - 'src/Symfony/Component/Intl/Resources/data/**'
defaults:
run:
shell: bash
jobs: jobs:
tests:
name: Tests (intl-data)
runs-on: ubuntu-latest
tests: steps:
name: Tests (intl-data) - name: Checkout
runs-on: ubuntu-latest uses: actions/checkout@v2
steps: - name: Define the ICU version
- name: Checkout run: |
uses: actions/checkout@v2 SYMFONY_ICU_VERSION=$(php -r 'require "src/Symfony/Component/Intl/Intl.php"; echo Symfony\Component\Intl\Intl::getIcuStubVersion();')
echo "SYMFONY_ICU_VERSION=$SYMFONY_ICU_VERSION" >> $GITHUB_ENV
- name: Define the ICU version - name: Setup PHP
run: | uses: shivammathur/setup-php@v2
SYMFONY_ICU_VERSION=$(php -r 'require "src/Symfony/Component/Intl/Intl.php"; echo Symfony\Component\Intl\Intl::getIcuStubVersion();') with:
echo "SYMFONY_ICU_VERSION=$SYMFONY_ICU_VERSION" >> $GITHUB_ENV coverage: "none"
extensions: "zip,intl-${{env.SYMFONY_ICU_VERSION}}"
ini-values: "memory_limit=-1"
php-version: "7.4"
- name: Setup PHP - name: Install dependencies
uses: shivammathur/setup-php@v2 run: |
with: echo "::group::composer update"
coverage: "none" composer update --no-progress --no-suggest --ansi
extensions: "zip,intl-${{env.SYMFONY_ICU_VERSION}}" echo "::endgroup::"
ini-values: "memory_limit=-1" echo "::group::install phpunit"
php-version: "7.4" ./phpunit install
echo "::endgroup::"
- name: Install dependencies - name: Report the ICU version
run: | run: icu-config --version && php -i | grep 'ICU version'
echo "::group::composer update"
composer update --no-progress --no-suggest --ansi
echo "::endgroup::"
echo "::group::install phpunit"
./phpunit install
echo "::endgroup::"
- name: Report the ICU version - name: Run intl-data tests
run: icu-config --version && php -i | grep 'ICU version' run: ./phpunit --group intl-data -v
- name: Run intl-data tests
run: ./phpunit --group intl-data -v

View File

@ -1,28 +1,31 @@
name: PhpUnitBridge name: PhpUnitBridge
on: on:
push: push:
paths: paths:
- 'src/Symfony/Bridge/PhpUnit/**' - 'src/Symfony/Bridge/PhpUnit/**'
pull_request: pull_request:
paths: paths:
- 'src/Symfony/Bridge/PhpUnit/**' - 'src/Symfony/Bridge/PhpUnit/**'
defaults:
run:
shell: bash
jobs: jobs:
lint:
name: Lint
runs-on: ubuntu-latest
lint: steps:
name: Lint - name: Checkout
runs-on: ubuntu-latest uses: actions/checkout@v2
steps: - name: Setup PHP
- name: Checkout uses: shivammathur/setup-php@v2
uses: actions/checkout@v2 with:
coverage: "none"
php-version: "5.5"
- name: Setup PHP - name: Lint
uses: shivammathur/setup-php@v2 run: find ./src/Symfony/Bridge/PhpUnit -name '*.php' | grep -v -e /Tests/ -e ForV6 -e ForV7 -e ForV8 -e ForV9 -e ConstraintLogicTrait | parallel -j 4 php -l {}
with:
coverage: "none"
php-version: "5.5"
- name: Lint
run: find ./src/Symfony/Bridge/PhpUnit -name '*.php' | grep -v -e /Tests/ -e ForV6 -e ForV7 -e ForV8 -e ForV9 -e ConstraintLogicTrait | parallel -j 4 php -l {}

View File

@ -3,6 +3,10 @@ name: Static analysis
on: on:
pull_request: ~ pull_request: ~
defaults:
run:
shell: bash
jobs: jobs:
psalm: psalm:
name: Psalm name: Psalm
@ -17,81 +21,38 @@ jobs:
ini-values: "memory_limit=-1" ini-values: "memory_limit=-1"
coverage: none coverage: none
- name: Checkout PR - name: Checkout target branch
uses: actions/checkout@v2
with:
path: pr
- name: Checkout base
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
ref: ${{ github.base_ref }} ref: ${{ github.base_ref }}
path: base
- name: Checkout PR
uses: actions/checkout@v2
- name: Configure composer - name: Configure composer
run: | run: |
cd base COMPOSER_HOME="$(composer config home)"
COMPOSER_HOME="$(composer config home)" ([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json" echo "COMPOSER_ROOT_VERSION=$(grep -m1 SYMFONY_VERSION .travis.yml | grep -o '[0-9.x]*').x-dev" >> $GITHUB_ENV
echo "COMPOSER_ROOT_VERSION=$(grep -m1 SYMFONY_VERSION .travis.yml | grep -o '[0-9.x]*').x-dev" >> $GITHUB_ENV
- name: Determine composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: composer-${{ github.base_ref }}
restore-keys: composer-
- name: Install Psalm - name: Install Psalm
run: | run: |
composer require psalm/phar echo "::group::modify composer.json"
cp ./vendor/bin/psalm.phar base/psalm.phar composer remove --no-update --no-interaction symfony/phpunit-bridge
cp ./vendor/bin/psalm.phar pr/psalm.phar composer require --no-update psalm/phar phpunit/phpunit php-http/discovery psr/event-dispatcher
echo "::endgroup::"
- name: Install dependencies for base echo "::group::composer update"
run: | composer update --no-progress --ansi
cd base git checkout composer.json
echo "::group::modify composer.json" echo "::endgroup::"
composer remove symfony/phpunit-bridge --no-interaction --no-update ./vendor/bin/psalm.phar --version
composer require --no-update phpunit/phpunit php-http/discovery psr/event-dispatcher
echo "::endgroup::"
echo "::group::composer update"
composer update --no-progress --ansi
echo "::endgroup::"
- name: Generate Psalm baseline - name: Generate Psalm baseline
run: | run: |
cd base git checkout -m ${{ github.base_ref }}
./psalm.phar --set-baseline=.github/psalm/psalm.baseline.xml --no-progress ./vendor/bin/psalm.phar --set-baseline=.github/psalm/psalm.baseline.xml --no-progress
git checkout -m FETCH_HEAD
- name: Copy baseline
run: |
cp base/.github/psalm/psalm.baseline.xml pr/.github/psalm/psalm.baseline.xml
- name: Install dependencies for PR
run: |
cd pr
echo "::group::modify composer.json"
composer remove symfony/phpunit-bridge --no-interaction --no-update
composer require --no-update phpunit/phpunit php-http/discovery psr/event-dispatcher
echo "::endgroup::"
echo "::group::composer update"
composer update --no-progress --ansi
echo "::endgroup::"
- name: Cache Psalm
uses: actions/cache@v2
with:
path: pr/.github/psalm/cache/
key: psalm-${{ github.base_ref }}
restore-keys: psalm-
- name: Psalm - name: Psalm
run: | run: |
cd pr ./vendor/bin/psalm.phar --output-format=github --no-progress
./psalm.phar --version
./psalm.phar --output-format=github --no-progress

View File

@ -1,190 +1,193 @@
name: Tests name: Tests
on: on:
push: push:
pull_request: pull_request:
defaults:
run:
shell: bash
jobs: jobs:
integration:
name: Integration
runs-on: ubuntu-latest
integration: strategy:
name: Integration matrix:
runs-on: ubuntu-latest php: ['7.2', '7.4']
strategy: services:
matrix: postgres:
php: ['7.2', '7.4'] image: postgres:9.6-alpine
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: 'password'
ldap:
image: bitnami/openldap
ports:
- 3389:3389
env:
LDAP_ADMIN_USERNAME: admin
LDAP_ADMIN_PASSWORD: symfony
LDAP_ROOT: dc=symfony,dc=com
LDAP_PORT_NUMBER: 3389
LDAP_USERS: a
LDAP_PASSWORDS: a
redis:
image: redis:6.0.0
ports:
- 6379:6379
redis-cluster:
image: grokzen/redis-cluster:5.0.4
ports:
- 7000:7000
- 7001:7001
- 7002:7002
- 7003:7003
- 7004:7004
- 7005:7005
- 7006:7006
env:
STANDALONE: 1
redis-sentinel:
image: bitnami/redis-sentinel:6.0
ports:
- 26379:26379
env:
REDIS_MASTER_HOST: redis
REDIS_MASTER_SET: redis_sentinel
REDIS_SENTINEL_QUORUM: 1
memcached:
image: memcached:1.6.5
ports:
- 11211:11211
rabbitmq:
image: rabbitmq:3.8.3
ports:
- 5672:5672
mongodb:
image: mongo
ports:
- 27017:27017
couchbase:
image: couchbase:6.5.1
ports:
- 8091:8091
- 8092:8092
- 8093:8093
- 8094:8094
- 11210:11210
sqs:
image: asyncaws/testing-sqs
ports:
- 9494:9494
zookeeper:
image: wurstmeister/zookeeper:3.4.6
kafka:
image: wurstmeister/kafka:2.12-2.4.1
ports:
- 9092:9092
env:
KAFKA_AUTO_CREATE_TOPICS_ENABLE: false
KAFKA_CREATE_TOPICS: 'test-topic:1:1:compact'
KAFKA_ADVERTISED_HOST_NAME: 127.0.0.1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_ADVERTISED_PORT: 9092
services: steps:
postgres: - name: Checkout
image: postgres:9.6-alpine uses: actions/checkout@v2
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: 'password'
ldap:
image: bitnami/openldap
ports:
- 3389:3389
env:
LDAP_ADMIN_USERNAME: admin
LDAP_ADMIN_PASSWORD: symfony
LDAP_ROOT: dc=symfony,dc=com
LDAP_PORT_NUMBER: 3389
LDAP_USERS: a
LDAP_PASSWORDS: a
redis:
image: redis:6.0.0
ports:
- 6379:6379
redis-cluster:
image: grokzen/redis-cluster:5.0.4
ports:
- 7000:7000
- 7001:7001
- 7002:7002
- 7003:7003
- 7004:7004
- 7005:7005
- 7006:7006
env:
STANDALONE: 1
redis-sentinel:
image: bitnami/redis-sentinel:6.0
ports:
- 26379:26379
env:
REDIS_MASTER_HOST: redis
REDIS_MASTER_SET: redis_sentinel
REDIS_SENTINEL_QUORUM: 1
memcached:
image: memcached:1.6.5
ports:
- 11211:11211
rabbitmq:
image: rabbitmq:3.8.3
ports:
- 5672:5672
mongodb:
image: mongo
ports:
- 27017:27017
couchbase:
image: couchbase:6.5.1
ports:
- 8091:8091
- 8092:8092
- 8093:8093
- 8094:8094
- 11210:11210
sqs:
image: asyncaws/testing-sqs
ports:
- 9494:9494
zookeeper:
image: wurstmeister/zookeeper:3.4.6
kafka:
image: wurstmeister/kafka:2.12-2.4.1
ports:
- 9092:9092
env:
KAFKA_AUTO_CREATE_TOPICS_ENABLE: false
KAFKA_CREATE_TOPICS: 'test-topic:1:1:compact'
KAFKA_ADVERTISED_HOST_NAME: 127.0.0.1
KAFKA_ZOOKEEPER_CONNECT: 'zookeeper:2181'
KAFKA_ADVERTISED_PORT: 9092
steps: - name: Install system dependencies
- name: Checkout run: |
uses: actions/checkout@v2 echo "::group::apt-get update"
sudo apt-get update
echo "::endgroup::"
- name: Install system dependencies echo "::group::install tools & libraries"
run: | sudo apt-get install librdkafka-dev
echo "::group::apt-get update" echo "::endgroup::"
sudo apt-get update
echo "::endgroup::"
echo "::group::install tools & libraries" - name: Configure Couchbase
sudo apt-get install librdkafka-dev run: |
echo "::endgroup::" curl -s -u 'username=Administrator&password=111111' -X POST http://localhost:8091/node/controller/setupServices -d 'services=kv%2Cn1ql%2Cindex%2Cfts'
curl -s -X POST http://localhost:8091/settings/web -d 'username=Administrator&password=111111&port=SAME'
curl -s -u Administrator:111111 -X POST http://localhost:8091/pools/default/buckets -d 'ramQuotaMB=100&bucketType=ephemeral&name=cache'
curl -s -u Administrator:111111 -X POST http://localhost:8091/pools/default -d 'memoryQuota=256'
- name: Configure Couchbase - name: Setup PHP
run: | uses: shivammathur/setup-php@v2
curl -s -u 'username=Administrator&password=111111' -X POST http://localhost:8091/node/controller/setupServices -d 'services=kv%2Cn1ql%2Cindex%2Cfts' with:
curl -s -X POST http://localhost:8091/settings/web -d 'username=Administrator&password=111111&port=SAME' coverage: "none"
curl -s -u Administrator:111111 -X POST http://localhost:8091/pools/default/buckets -d 'ramQuotaMB=100&bucketType=ephemeral&name=cache' extensions: "json,couchbase,memcached,mongodb,redis,rdkafka,xsl,ldap"
curl -s -u Administrator:111111 -X POST http://localhost:8091/pools/default -d 'memoryQuota=256' ini-values: "memory_limit=-1"
php-version: "${{ matrix.php }}"
tools: pecl
- name: Setup PHP - name: Display versions
uses: shivammathur/setup-php@v2 run: |
with: php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;'
coverage: "none" php -i
extensions: "json,couchbase,memcached,mongodb,redis,rdkafka,xsl,ldap"
ini-values: "memory_limit=-1"
php-version: "${{ matrix.php }}"
tools: pecl
- name: Display versions - name: Load fixtures
run: | uses: docker://bitnami/openldap
php -r 'foreach (get_loaded_extensions() as $extension) echo $extension . " " . phpversion($extension) . PHP_EOL;' with:
php -i entrypoint: /bin/bash
args: -c "(/opt/bitnami/openldap/bin/ldapwhoami -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony||sleep 5) && /opt/bitnami/openldap/bin/ldapadd -h ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif && /opt/bitnami/openldap/bin/ldapdelete -h ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony cn=a,ou=users,dc=symfony,dc=com"
- name: Load fixtures - name: Configure composer
uses: docker://bitnami/openldap run: |
with: COMPOSER_HOME="$(composer config home)"
entrypoint: /bin/bash composer self-update
args: -c "(/opt/bitnami/openldap/bin/ldapwhoami -h localhost:3389 -D cn=admin,dc=symfony,dc=com -w symfony||sleep 5) && /opt/bitnami/openldap/bin/ldapadd -h ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony -f src/Symfony/Component/Ldap/Tests/Fixtures/data/fixtures.ldif && /opt/bitnami/openldap/bin/ldapdelete -h ldap:3389 -D cn=admin,dc=symfony,dc=com -w symfony cn=a,ou=users,dc=symfony,dc=com" ([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
echo "COMPOSER_ROOT_VERSION=$(grep -m1 SYMFONY_VERSION .travis.yml | grep -o '[0-9.x]*').x-dev" >> $GITHUB_ENV
- name: Configure composer - name: Determine composer cache directory
run: | id: composer-cache
COMPOSER_HOME="$(composer config home)" run: echo "::set-output name=directory::$(composer config cache-dir)"
composer self-update
([ -d "$COMPOSER_HOME" ] || mkdir "$COMPOSER_HOME") && cp .github/composer-config.json "$COMPOSER_HOME/config.json"
echo "COMPOSER_ROOT_VERSION=$(grep -m1 SYMFONY_VERSION .travis.yml | grep -o '[0-9.x]*').x-dev" >> $GITHUB_ENV
- name: Determine composer cache directory - name: Cache composer dependencies
id: composer-cache uses: actions/cache@v1
run: echo "::set-output name=directory::$(composer config cache-dir)" with:
path: ${{ steps.composer-cache.outputs.directory }}
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ matrix.php }}-composer-
- name: Cache composer dependencies - name: Install dependencies
uses: actions/cache@v1 run: |
with: echo "::group::composer update"
path: ${{ steps.composer-cache.outputs.directory }} composer require --dev --no-update mongodb/mongodb:@stable
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} composer update --no-progress --ansi
restore-keys: ${{ matrix.php }}-composer- echo "::endgroup::"
echo "::group::install phpunit"
./phpunit install
echo "::endgroup::"
- name: Install dependencies - name: Run tests
run: | run: ./phpunit --group integration -v
echo "::group::composer update" env:
composer require --dev --no-update mongodb/mongodb:@stable REDIS_HOST: localhost
composer update --no-progress --ansi REDIS_CLUSTER_HOSTS: 'localhost:7000 localhost:7001 localhost:7002 localhost:7003 localhost:7004 localhost:7005'
echo "::endgroup::" REDIS_SENTINEL_HOSTS: 'localhost:26379'
echo "::group::install phpunit" REDIS_SENTINEL_SERVICE: redis_sentinel
./phpunit install MESSENGER_REDIS_DSN: redis://127.0.0.1:7006/messages
echo "::endgroup::" MESSENGER_AMQP_DSN: amqp://localhost/%2f/messages
MESSENGER_SQS_DSN: "sqs://localhost:9494/messages?sslmode=disable&poll_timeout=0.01"
MESSENGER_SQS_FIFO_QUEUE_DSN: "sqs://localhost:9494/messages.fifo?sslmode=disable&poll_timeout=0.01"
MEMCACHED_HOST: localhost
LDAP_HOST: localhost
LDAP_PORT: 3389
MONGODB_HOST: localhost
KAFKA_BROKER: 127.0.0.1:9092
POSTGRES_HOST: localhost
- name: Run tests - name: Run HTTP push tests
run: ./phpunit --group integration -v if: matrix.php == '7.4'
env: run: |
REDIS_HOST: localhost [ -d .phpunit ] && mv .phpunit .phpunit.bak
REDIS_CLUSTER_HOSTS: 'localhost:7000 localhost:7001 localhost:7002 localhost:7003 localhost:7004 localhost:7005' wget -q https://github.com/symfony/binary-utils/releases/download/v0.1/vulcain_0.1.3_Linux_x86_64.tar.gz -O - | tar xz && mv vulcain /usr/local/bin
REDIS_SENTINEL_HOSTS: 'localhost:26379' docker run --rm -e COMPOSER_ROOT_VERSION -v $(pwd):/app -v $(which composer):/usr/local/bin/composer -v /usr/local/bin/vulcain:/usr/local/bin/vulcain -w /app php:7.4-alpine ./phpunit src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php --filter testHttp2Push
REDIS_SENTINEL_SERVICE: redis_sentinel sudo rm -rf .phpunit
MESSENGER_REDIS_DSN: redis://127.0.0.1:7006/messages [ -d .phpunit.bak ] && mv .phpunit.bak .phpunit
MESSENGER_AMQP_DSN: amqp://localhost/%2f/messages
MESSENGER_SQS_DSN: "sqs://localhost:9494/messages?sslmode=disable&poll_timeout=0.01"
MESSENGER_SQS_FIFO_QUEUE_DSN: "sqs://localhost:9494/messages.fifo?sslmode=disable&poll_timeout=0.01"
MEMCACHED_HOST: localhost
LDAP_HOST: localhost
LDAP_PORT: 3389
MONGODB_HOST: localhost
KAFKA_BROKER: 127.0.0.1:9092
POSTGRES_HOST: localhost
- name: Run HTTP push tests
if: matrix.php == '7.4'
run: |
[ -d .phpunit ] && mv .phpunit .phpunit.bak
wget -q https://github.com/symfony/binary-utils/releases/download/v0.1/vulcain_0.1.3_Linux_x86_64.tar.gz -O - | tar xz && mv vulcain /usr/local/bin
docker run --rm -e COMPOSER_ROOT_VERSION -v $(pwd):/app -v $(which composer):/usr/local/bin/composer -v /usr/local/bin/vulcain:/usr/local/bin/vulcain -w /app php:7.4-alpine ./phpunit src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php --filter testHttp2Push
sudo rm -rf .phpunit
[ -d .phpunit.bak ] && mv .phpunit.bak .phpunit

View File

@ -13,6 +13,7 @@ namespace Symfony\Component\Cache\Adapter;
use Predis\Connection\Aggregate\ClusterInterface; use Predis\Connection\Aggregate\ClusterInterface;
use Predis\Connection\Aggregate\PredisCluster; use Predis\Connection\Aggregate\PredisCluster;
use Predis\Connection\Aggregate\ReplicationInterface;
use Predis\Response\Status; use Predis\Response\Status;
use Symfony\Component\Cache\Exception\InvalidArgumentException; use Symfony\Component\Cache\Exception\InvalidArgumentException;
use Symfony\Component\Cache\Exception\LogicException; use Symfony\Component\Cache\Exception\LogicException;
@ -282,7 +283,14 @@ EOLUA;
return $this->redisEvictionPolicy; return $this->redisEvictionPolicy;
} }
foreach ($this->getHosts() as $host) { $hosts = $this->getHosts();
$host = reset($hosts);
if ($host instanceof \Predis\Client && $host->getConnection() instanceof ReplicationInterface) {
// Predis supports info command only on the master in replication environments
$hosts = [$host->getClientFor('master')];
}
foreach ($hosts as $host) {
$info = $host->info('Memory'); $info = $host->info('Memory');
$info = $info['Memory'] ?? $info; $info = $info['Memory'] ?? $info;

View File

@ -14,6 +14,7 @@ namespace Symfony\Component\Cache\Traits;
use Predis\Command\Redis\UNLINK; use Predis\Command\Redis\UNLINK;
use Predis\Connection\Aggregate\ClusterInterface; use Predis\Connection\Aggregate\ClusterInterface;
use Predis\Connection\Aggregate\RedisCluster; use Predis\Connection\Aggregate\RedisCluster;
use Predis\Connection\Aggregate\ReplicationInterface;
use Predis\Response\Status; use Predis\Response\Status;
use Symfony\Component\Cache\Exception\CacheException; use Symfony\Component\Cache\Exception\CacheException;
use Symfony\Component\Cache\Exception\InvalidArgumentException; use Symfony\Component\Cache\Exception\InvalidArgumentException;
@ -368,7 +369,14 @@ trait RedisTrait
$evalArgs = [[$namespace], 0]; $evalArgs = [[$namespace], 0];
} }
foreach ($this->getHosts() as $host) { $hosts = $this->getHosts();
$host = reset($hosts);
if ($host instanceof \Predis\Client && $host->getConnection() instanceof ReplicationInterface) {
// Predis supports info command only on the master in replication environments
$hosts = [$host->getClientFor('master')];
}
foreach ($hosts as $host) {
if (!isset($namespace[0])) { if (!isset($namespace[0])) {
$cleared = $host->flushDb() && $cleared; $cleared = $host->flushDb() && $cleared;
continue; continue;