20 lines
686 B
PHP
20 lines
686 B
PHP
<?php
|
|
use Psr\Container\ContainerInterface;
|
|
|
|
return [
|
|
Predis\ClientInterface::class => function(ContainerInterface $container) {
|
|
$options = [
|
|
'scheme' => 'tcp',
|
|
'host' => $container->has('REDIS_HOST') ? $container->get('REDIS_HOST') : 'redis',
|
|
'port' => $container->has('REDIS_PORT') ? $container->get('REDIS_PORT') : 6379
|
|
];
|
|
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);
|
|
},
|
|
];
|