php - With memcache, redis throw exception:read error on connection -


in project, want use redis while using memcached(it's old system , donnot want outright replace memcached).but when try push element list in redis, meet exception "read error on connection". find if connecting memcached before connecting redis, throw exception, connecting redis firstly can avoid problem.

environment: nginx + php-fpm + php 5.3.3 + redis 2.8.19

use connect instead of pconnect can fix exception. perfer use pconnect. here code:

$memcache = new memcached ('client'); $memcache->addserver('127.0.0.1', '8022');  $memcache->set ('mckey', 1); echo $memcache->get('mckey');  $redis = new redis(); $redis->pconnect('127.0.0.1', '6379', 1000); $redis->setoption(redis::opt_read_timeout, -1);  try {     $redis->lpush('mykey', 1, 2);     echo 'ok'; } catch (exception $e) {     echo $e->getmessage(); } 

any problem of code here?


Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -