Skip to content

Commit

Permalink
Merge pull request #49 from php-cache/aequasi-patch-1
Browse files Browse the repository at this point in the history
Have to auth after connecting
  • Loading branch information
cryptiklemur committed Nov 14, 2016
2 parents e81e97a + 920ab44 commit c3d344c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Factory/RedisFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ public function getAdapter(array $config)
throw new ConnectException(sprintf('Could not connect to Redis database on "%s:%s".', $config['host'], $config['port']));
}
} else {
if (false === $client->connect($dsn->getFirstHost(), $dsn->getFirstPort())) {
throw new ConnectException(sprintf('Could not connect to Redis database on "%s:%s".', $dsn->getFirstHost(), $dsn->getFirstPort()));
}

if (!empty($dsn->getPassword())) {
if (false === $client->auth($dsn->getPassword())) {
throw new ConnectException('Could not connect authenticate connection to Redis database.');
}
}

if (false === $client->connect($dsn->getFirstHost(), $dsn->getFirstPort())) {
throw new ConnectException(sprintf('Could not connect to Redis database on "%s:%s".', $dsn->getFirstHost(), $dsn->getFirstPort()));
}

if ($dsn->getDatabase() !== null) {
if (false === $client->select($dsn->getDatabase())) {
throw new ConnectException(sprintf('Could not select Redis database with index "%s".', $dsn->getDatabase()));
Expand Down

0 comments on commit c3d344c

Please sign in to comment.