使用predis的Redis超时 [英] redis timeout with predis

查看:295
本文介绍了使用predis的Redis超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将redis与php一起使用(predis位于 http://github.com/nrk/predis/),并且经常遇到超时问题.堆栈跟踪显示:

I'm using redis with php (predis at http://github.com/nrk/predis/) and am experiencing frequent timeout. The stack trace shows:

[04-Apr-2010 03:39:50] PHP Fatal error:  Uncaught exception 'Predis_ClientException' with message 'Connection timed out' in redis.php:697
Stack trace:
#0 redis.php(757): Predis_Connection->connect()
#1 redis.php(729): Predis_Connection->getSocket()
#2 redis.php(825): Predis_Connection->writeCommand(Object(Predis_Commands_ListRange))
#3 redis.php(165): Predis_ConnectionCluster->writeCommand(Object(Predis_Commands_ListRange))
#4 redis.php(173): Predis_Client->executeCommandInternal(Object(Predis_ConnectionCluster), Object(Predis_Commands_ListRange))
#5 redis.php(157): Predis_Client->executeCommand(Object(Predis_Commands_ListRange))
#6 [internal function]: Predis_Client->__call('lrange', Array)

这种情况一直发生,我不知道为什么.有人有什么主意吗?

This happens consistently and I have no idea why. Anyone has any idea?

推荐答案

我认为这是因为Redis默认情况下会关闭空闲连接.

I think this is because of idle connections are getting closed by default by Redis.

# Close the connection after a client is idle for N seconds (0 to disable)
timeout 0

这篇关于使用predis的Redis超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆