snc / redis-bundle获取控制器中的redist集群-symfony 3+

时间:2019-02-06 11:34:32

标签: symfony

我使用“ snc / redis-bundle”:“ 3.0.0-RC1”,

我将symfony 2.8更新为3.4

在控制器中,我有

$redis_cluster = $this->container->get('snc_redis.cluster');

$cached = $redis_cluster->get($resOneCacheName) 

获取

The "snc_redis.cluster" service or alias has been removed or inlined when the container was compiled. You should either make it public, or stop using the container directly and use dependency injection instead.

我如何获得Redis服务?

1 个答案:

答案 0 :(得分:0)

  

停止直接使用容器,而改为使用依赖项注入。

请参见https://symfony.com/doc/3.4/service_container/3.3-di-changes.html