20 lines
605 B
PHP
20 lines
605 B
PHP
![]() |
<?php
|
||
|
use Psr\Container\ContainerInterface;
|
||
|
|
||
|
return [
|
||
|
Predis\ClientInterface::class => 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);
|
||
|
},
|
||
|
];
|