How to override namespace argument in RedisAdapter for a Symfony4 app to cache

I want to use custom namespace in our RedisAdapter to cache in our Symfony4 app. However, when i want to set arguments like this in our services.yaml;

cache.adapter.redis:
        class: SymfonyComponentCacheAdapterRedisAdapter
        arguments:
            - '@Redis'
            - 'app'

I see this error message:

SymfonyComponentCacheTraitsRedisTrait::init() expects parameter 1 to be Redis, RedisArray, RedisCluster or PredisClientInterface, string given.

By the way, our cache config(config/packages/cache.yaml) is simple like below. So, how can I set namespace directly from any config?

    cache:
        app: cache.adapter.redis
        default_redis_provider: 'redis://%env(REDIS_HOST)%:%env(REDIS_PORT)%'

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *