mikebronner / laravel-model-caching

Eloquent model-caching made easy.
MIT License
2.24k stars 213 forks source link

Cannot use 'DEL' with redis-cluster. #364

Closed Nowi5 closed 4 years ago

Nowi5 commented 4 years ago

Describe the bug Expected: Clearing the cache across the packages of Laravel (Symfony) and Predis should work with AWS Redis Cluster.

image

Eloquent Query Please provide the complete eloquent query that caused the bug, for example:

$model->with('otherModel')->get();

Stack Trace The full stack trace from your log file.

Environment

Additional context have the same issue local and on AWS. Config database.php


'redis' => [
        'client' => 'predis',
        'cluster' => env('REDIS_CLUSTER', false),
        'options' => [
            'cluster' => 'redis',
            'parameters' => [
                'password' => env('REDIS_PASSWORD', null),
                'scheme' => env('REDIS_SCHEME', 'tcp'),
                ],
            'ssl' => ['verify_peer' => false]
        ],
        'clusters' => [
            'default' => [
                [
                    'scheme'   => env('REDIS_SCHEME', 'tcp'),
                    'host' => env('REDIS_HOST', 'localhost'),
                    'password' => env('REDIS_PASSWORD', null),
                    'port' => env('REDIS_PORT', 6379),
                    'database' => env('REDIS_DATABASE', 0),
                ],
                'options' => [
                    // Clustering specific options
                    'cluster' => 'redis',
                    // This tells Redis Client lib to follow redirects (from cluster)
                ]
            ],
            // duplicate of default
            'cache' => [
                [
                    'scheme'   => env('REDIS_SCHEME', 'tcp'),
                    'host' => env('REDIS_HOST', 'localhost'),
                    'password' => env('REDIS_PASSWORD', null),
                    'port' => env('REDIS_PORT', 6379),
                    'database' => env('REDIS_DATABASE', 0),
                ],
                'options' => [
                    // Clustering specific options
                    'cluster' => 'redis',
                    // This tells Redis Client lib to follow redirects (from cluster)
                ]
            ],
        ],
    ],

Using a AWS Redis Cluster with 3 nodes. Any idea where to start to debug?

mikebronner commented 4 years ago

Hi @Nowi5, thanks for writing in about this issue. This would almost certainly be an issue with Predis and AWS not being compatible with each other. This package just provides a functional layer on top of Laravel's caching mechanism. I would file a bug with Predis with a complete StackTrace and go from there. Please do keep me informed of your developments, in case I need to make any updates here. Best of luck!

Nowi5 commented 4 years ago

I have the same issues when using my local docker including redis. Let see if the Laravel Community can help: https://github.com/laravel/framework/issues/33733

mikebronner commented 4 years ago

@Nowi5 Awesome, looks like you got all bases covered. I subscribed to your two other tickets and will follow along to see what comes of it. :)

Nowi5 commented 4 years ago

@mikebronner Thank you for your support as always. Found a temporary solution back from 2017. Do you have any deeper insights to judge if that change makes actually sense? Thank you for your expert opinion.

mikebronner commented 4 years ago

@Nowi5 My recommendation would be to switch to PHPREDIS, as that is the recommended path forward by Laravel, I believe.

mikebronner commented 4 years ago

I'm going to work on a release that removes the predis dependency.

mikebronner commented 4 years ago

@Nowi5 Please give release 0.10.0 a try with PHPRedis and let me know how it goes.