Skip to content

Commit

Permalink
extend redis cluster params
Browse files Browse the repository at this point in the history
  • Loading branch information
sakuraovq committed Oct 13, 2019
1 parent 9d2a653 commit 7a678fd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/redis/src/Connector/PhpRedisConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public function connect(array $config, array $option): Redis
*
* @return RedisCluster
* @throws RedisClusterException
*
* @see https://raw.githubusercontent.com/zgb7mtr/phpredis_cluster_phpdoc/master/src/RedisCluster.php
*/
public function connectToCluster(array $config, array $option): RedisCluster
{
Expand All @@ -71,8 +73,9 @@ public function connectToCluster(array $config, array $option): RedisCluster
$timeout = $option['timeout'] ?? 0;
$persistent = $option['persistent'] ?? false;
$name = $option['name'] ?? '';
$auth = $option['auth'] ?? '';

$redisCluster = new RedisCluster($name, $servers, $timeout, $readTimeout, $persistent);
$redisCluster = new RedisCluster($name, $servers, $timeout, $readTimeout, $persistent, $auth);
return $redisCluster;
}

Expand Down
1 change: 1 addition & 0 deletions src/redis/test/testing/bean.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
'option' => [
'timeout' => 3,
'persistent' => true,
'auth' => 'passwordAuth-xxxx',
],
'clusters' => [
[
Expand Down
2 changes: 1 addition & 1 deletion src/redis/test/unit/Command/StringTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function testInc()
{
$key = \uniqid();

$redis = Redis::connection('redis.inc.pool');
$redis = Redis::connection('redis.inc.pool');

$this->assertEquals(1, $redis->incrBy($key, 1));
$redis->set($key, 2);
Expand Down

0 comments on commit 7a678fd

Please sign in to comment.