function(ContainerInterface $container) { $options = [ 'scheme' => 'tcp', 'host' => $container->get('REDIS_HOST'), 'port' => $container->get('REDIS_PORT') ]; if ($container->has('REDIS_USER')) { $options['username'] = $container->get('REDIS_USER'); } if ($container->has('REDIS_PASSWORD')) { $options['password'] = $container->get('REDIS_PASSWORD'); } return new Predis\Client($options); }, ];