关于redis空闲过长事件连接断开问题

我有一个cli脚本,需要长时间执行,用redis加锁,但是执行时间很长,等到解锁的时候,redis连接已经断开了,然后报错了用的phpredis.
host: string. can be a host, or the path to a unix domain socket. Starting from version 5.0.0 it is possible to specify schema
port: int, optional
timeout: float, value in seconds (optional, default is 0 meaning it will use default_socket_timeout)
reserved: should be ‘’ if retry_interval is specified
retry_interval: int, value in milliseconds (optional)
read_timeout: float, value in seconds (optional, default is 0 meaning it will use default_socket_timeout)
others: array, with PhpRedis >= 5.3.0, it allows setting auth and stream configuration.
下面是phpredis的参数,怎么可以设置让连接不会自动断开?

本作品采用《CC 协议》,转载必须注明作者和本文链接
讨论数量: 2
唐章明

redis定时ping一下

2个月前 评论

redis用长连接试一下

2个月前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!