Skip to content
This repository has been archived by the owner on Dec 12, 2021. It is now read-only.

Commit

Permalink
SymfonySessionRedisFactory fixed for Redis and REdisFactory fixed for…
Browse files Browse the repository at this point in the history
… connection options
  • Loading branch information
mkorkmaz committed Sep 19, 2017
1 parent acc96da commit e8c2b97
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
24 changes: 16 additions & 8 deletions src/RedisFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,29 @@ public function __invoke(ContainerInterface $container, $requestedName, array $o

private function connect()
{
$this->redisClient->connect(

$redisConfig = [
$this->config['redis']['host'],
$this->config['redis']['port'] ?? null,
$this->config['redis']['timeout'] ?? null,
$this->config['redis']['reserved'] ?? null,
$this->config['redis']['retry_interval'] ?? null
);
$this->config['redis']['port'] ?? 6379,
$this->config['redis']['timeout'] ?? 0
];

if (isset($this->config['redis']['retry_interval'])) {
$redisConfig[] = null;
$redisConfig[] = $this->config['redis']['retry_interval'];
} elseif (isset($this->config['redis']['reserved'])) {
$redisConfig[] = $this->config['redis']['reserved'];
}

$this->redisClient->connect(...$redisConfig);
}

private function pconnect()
{
$this->redisClient->pconnect(
$this->config['redis']['host'],
$this->config['redis']['port'] ?? null,
$this->config['redis']['timeout'] ?? null,
$this->config['redis']['port'] ?? 6379,
$this->config['redis']['timeout'] ?? 0,
$this->config['redis']['persistent_id'] ?? null
);
}
Expand Down
2 changes: 1 addition & 1 deletion src/SymfonySessionRedisFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
use Selami\Factories\Adapters\Symfony\Component\HttpFoundation\Session\Storage\Handler\RedisSessionHandler;
use Symfony\Component\HttpFoundation\Session\Session;
use Memcached;
use Redis;

class SymfonySessionRedisFactory implements FactoryInterface
{
Expand Down

0 comments on commit e8c2b97

Please sign in to comment.