官方文档没有太详细的解释,也没有搜索到
https://github.com/phpredis/phpredis/blob/develop/README.markdown#connect-open
$redis->connect('127.0.0.1', 6379);
$redis->connect('127.0.0.1'); // port 6379 by default
$redis->connect('127.0.0.1', 6379, 2.5); // 2.5 sec timeout.
$redis->connect('/tmp/redis.sock'); // unix domain socket.
$redis->connect('127.0.0.1', 6379, 1, NULL, 100); // 1 sec timeout, 100ms delay between reconnection attempts.
reserved 看字面意思应该是一个预留的参数,没啥实际作用;
retry_interval 怎么用?我试着设置了一个 1 秒的延迟,看表现并没有延迟啊
$redis = new Redis();
for ($i = 0; $i < 5; ++$i)
{
$result = $redis->connect('localhost', 19000, 10, NULL, 1000);
var_dump($result, $i);
}
1
oott123 2017-12-13 13:56:32 +08:00
retry_interval,字面意思就是,连接断开后每隔几秒后重试
|