mirror of
https://gitee.com/hyperf/hyperf.git
synced 2024-12-02 11:48:08 +08:00
Merge pull request #29 from limingxinleo/redis-timeout
Added some arguments of redis connect.
This commit is contained in:
commit
3fa5c8851f
@ -16,6 +16,9 @@ return [
|
||||
'auth' => env('REDIS_AUTH', ''),
|
||||
'port' => (int) env('REDIS_PORT', 6379),
|
||||
'db' => (int) env('REDIS_DB', 0),
|
||||
'timeout' => 0.0,
|
||||
'reserved' => null,
|
||||
'retry_interval' => 0,
|
||||
'pool' => [
|
||||
'min_connections' => 1,
|
||||
'max_connections' => 10,
|
||||
|
@ -62,9 +62,12 @@ class RedisConnection extends BaseConnection implements ConnectionInterface
|
||||
$port = $this->config['port'] ?? 6379;
|
||||
$auth = $this->config['auth'] ?? null;
|
||||
$db = $this->config['db'] ?? 0;
|
||||
$timeout = $this->config['timeout'] ?? 0.0;
|
||||
$reserved = $this->config['reserved'] ?? null;
|
||||
$retryInterval = $this->config['retry_interval'] ?? 0;
|
||||
|
||||
$redis = new \Redis();
|
||||
if (! $redis->connect($host, $port)) {
|
||||
if (! $redis->connect($host, $port, $timeout, $reserved, $retryInterval)) {
|
||||
throw new ConnectionException('Connection reconnect failed.');
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user