0

I have a Symfony 5 running and i installed redis with

pecl install redis

composer require snc/redis-bundle

composer require predis/predis

My confg/snc_redis.yml has

snc_redis:
    clients:
        default:
            type: predis
            alias: default
            dsn: redis://ops_redis_1

and in stalled redis lib through pecl install redis

My code is:

 /**
     * @Route("/redis/set/{key}/{value}")
     */
    public function redisSet(string $key, string $value) {

        $this->redisClient->set($key, $value);
        return new Response("Adding key " . $key . ' with value ' .$value);
    }

I got this error message:

Warning: Declaration of Snc\RedisBundle\Client\Phpredis\Client::zAdd($key, $score1, $value1, $score2 = NULL, $value2 = NULL, $scoreN = NULL, $valueN = NULL) should be compatible with Redis::zAdd($key, $score, $value, ...$extra_args)

What does this means ? That phpredis client is not compatible with native php redis ?

Has anyone faced this before ?

  • It looks like there is a backward compatibility issue related to `snc/redis-bundle`. There are some discussions in here https://github.com/snc/SncRedisBundle/issues/399 – Ersoy Aug 06 '20 at 21:10
  • 1
    I see, discussions are getting complicated, solutions given does not satisfy me, some are sying to fix phpredis version in composer.lock, others that pecl redis version should be fixed to 3.xxx, one is giving a new Client.php version to manage through conf files ... Even though symfony cache does not handle advanced Redis options i think i am gonna remove snc/redis and use it since Redis is mostly interesting for caching capabilites ... Thanks for the help – Walik Workshop Aug 08 '20 at 09:00

1 Answers1

0

I assume that you imported the wrong Redis client.

Change

use Snc\RedisBundle\Client\Phpredis\Client;

to

use Predis\Client;