Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[5.8] Use ClusterInterface instead of PredisCluster #28706

merged 1 commit into from Jun 3, 2019


None yet
2 participants
Copy link

commented Jun 3, 2019

The issue

There is an issue when running the artisan cache:clear command with a redis cluster using the Predis library:

php artisan cache:clear

Predis\NotSupportedException  : Cannot use 'FLUSHDB' with redis-cluster.

The reason why

There is logic to check whether the connection is using a cluster or single node, which determines how the flush command should be executed. However the condition for this check isn't working correctly.

The current logic checks to see if the connection is an instance of Predis\Connection\Aggregate\PredisCluster, however when I was debugging the error I noticed the instance I got was of Predis\Connection\Aggregate\RedisCluster.

The proposed solution

Both of these classes implement the Predis\Connection\Aggregate\ClusterInterface interface, so by checking if the connection is an instance of this interface instead, the error no longer occurs.

Supporting info

My Redis config in config/database.php is:

'redis' => [
    'client' => 'predis',

    'options' => [
        'cluster' => 'redis',

    'clusters' => [
        'default' => [
            'parameters' => [
                'host' => '',
                'password' => null,
                'port' => 6379,


@GrahamCampbell GrahamCampbell changed the title Use ClusterInterface instead of PredisCluster [5.8] Use ClusterInterface instead of PredisCluster Jun 3, 2019

@taylorotwell taylorotwell merged commit 7db4308 into laravel:5.8 Jun 3, 2019

2 checks passed

continuous-integration/styleci/pr The analysis has passed
continuous-integration/travis-ci/pr The Travis CI build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.