php-bundles/redis-bundle

How to use this Bundle ?

puterakahfi opened this issue · 1 comments

Hi,
I have installed this bundle on Symfony 4
but looks like the configuration not passed to client, it's always pointing to 127.0.0.1

here my .env config

REDIS_URL=tcp://asdocker-redis:6379?database=0

my controller
use SymfonyBundles\RedisBundle\Redis;

$redis = new Redis\Client();

but, I always get connection refused response

"Connection refused [tcp://127.0.0.1:6379]",

is there something miss in my configuration ?

Thanks
Kahfi

Hi!

You need to embed a client through DependencyInjection. For example:

public function testAction(Redis\Client $redis)
{
    $redis->...
}

or with helps interface:

public function testAction(Redis\ClientInterface $redis)
{
    $redis->...
}