redis 超时时间
PHP中文网
PHP中文网 2017-04-24 09:13:48
0
3
905

$redis->connect('192.168.200.253', 637912,3);
有个疑问,这个3秒是指连接上以后3秒后断开,还是3秒没连接上认为是超时呢?这个连接超时到底是指没连接上的超时还是连接上以后的的超时。

PHP中文网
PHP中文网

认证高级PHP讲师

reply all(3)
大家讲道理
  • Generally speaking, the timeout time of the connect function refers to the link waiting time in TCP, that is, the link establishment time is 3 seconds. If the link is not successful in 3 seconds, the function returns.

  • In addition, by default, the server side of redis will automatically kill the link if there is no access for 5 seconds. The client side is not aware of this. It is best to judge the availability of the connection every time it is used; it is recommended to call it when there is no data access for 5 seconds. Ping/pang mechanism to prevent link failure;

PHPzhong

There are many PHP drivers for redis => http://redis.io/clients#php I don’t know which one you are using.
But written in the parameters of the connect method, it should be the timeout for establishing the link.

小葫芦

Generally speaking, what comes with connect is the timeout of the connection.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template