4
我有Zend Framework項目,我決定使用Rediska作爲Redis客戶端。 Rediska爲ZF提供緩存後端適配器 - Rediska_Zend_Cache_Backend_Redis。在緩存過程中Redis錯誤「連接讀取超時」
我從DB對象集合中獲取對象,並嘗試將它保存在緩存中但出現錯誤:連接讀取超時。我的代碼示例:
$rediskaOptions = array(
'name' => 'cache',
'namespace' => 'Cache_',
'servers' => array('cache' => array(
'host' => Rediska_Connection::DEFAULT_HOST,
'port' => Rediska_Connection::DEFAULT_PORT,
'password' => 'qwerty'
)
)
);
$cache = Zend_Cache::factory('Core', 'Rediska_Zend_Cache_Backend_Redis',
array('lifetime' => NULL, 'automatic_serialization' => true),
array('rediska' => $rediskaOptions), false, true
);
$cacheId = 'news_main';
if (!($topics = $cache->load($cacheId))) {
$topics = DAOFactory::getInstance()->getTopicDAO()->fetchTopic(1);
$cache->save($topics, $cacheId);
}
的序列化後的內容大小爲26787個字節。 也許Redis有發送的大小限制?
值的Redis大小限制遠高於此值。字符串值的理論限制是512MB。存儲26KB對象應該沒有問題。 – 2012-02-11 09:59:33
readTimeout參數的值是多少? http://rediska.geometria-lab.net/documentation/configuration/servers/ – 2012-02-11 10:11:52
我在/etc/redis/redis.conf中設置了timeout 0,rediska中的readTimeout默認值爲null。 – Dmitro 2012-02-11 14:29:21