snc/SncRedisBundle

Upgrading sncRedisBundle from 3.6 to 4.4

danrod7 opened this issue · 3 comments

Hi, I am currently upgrading my project versions and thus, sncRedisBundle.

Was previously running on 3.6, all fine but I cannot seem to find any documentation regarding how to upgrade the doctrine caching.
This was my previous :

snc_redis:
   clients:
     # Define your clients here. The example below connects to database 0 of the default Redis server.
     #
     # See https://github.com/snc/SncRedisBundle/blob/master/Resources/doc/index.md for instructions on
     # how to configure the bundle.
     default:
       type: "predis"
       alias: default
       dsn: "%env(REDIS_URL)%"
     doctrine:
       type: "%app.redis_type%" # use parameter instead of env because snc-redis does not work
       alias: doctrine
       dsn: "%env(REDIS_URL)%"

services.yaml :

   App\Service\RedisClient: 
    lazy: true
    class: App\Service\RedisClient
    arguments: ['?@snc_redis.default', '%enable_redis%']   

Nothing in the cache.yaml

But snc_redis no longer supports doctrine in that way.

Could use some help on how to make it work with this current version ?

Many thanks !

Hi, this is addressed in https://github.com/snc/SncRedisBundle/blob/master/UPGRADE.md. What exactly you struggle with?

Hi,

Thanks for the answer.
Setting up the cache pools to make it work like previously is what I'm struggling with.

Cant seem to find where it is explained.
Also, are there other changes that are required for the bundle to work ?

You should read https://symfony.com/doc/current/reference/configuration/doctrine.html#caching-drivers and https://symfony.com/doc/current/cache.html

Here is a simple example

snc_redis:
   clients:
     default:
       type: "predis"
       alias: default
       dsn: "%env(REDIS_URL)%"
framework:
  cache:
    pools:
      cache.doctrine:
        adapter: cache.adapter.redis
        provider: snc_redis.default
doctrine:
  orm:
    query_cache_driver:
      type: pool
      pool: cache.doctrine