Symfony 5 缓存组件 AWS elasticache 无效 DSN

问题描述

由于没有任何相关的帖子,有没有人在使用symfony缓存组件和使用AWS ElasitCache Redis集群时,使用提供的端点时出现这种错误

the option "dsn" with value "{redis-dsn}" is invalid

dsn:redis://{aws-redis-uri}:6379

cache.yaml 看起来像这样:

framework:
cache:
    pools:
        status.cache:
            adapter: cache.app

        redis.cache:
            adapter: cache.adapter.redis
            provider: '%env(REdis_URL)%'

调用错误的操作:

  $client = RedisAdapter::createConnection(
            $_ENV['REdis_URL'],[
                'timeout'       => 3,'persistent'    => 1,]
        );

解决方法

解决了这个问题,它与这个问题无关。但要确保必须安装 predis 扩展。