My project with Phalcon incubator's Redis backend cache. But it has some problem. When I use native PHP's Redis class ,it works properly and it shows "Cannot connect to Redisd server" when use Redis backend cache:
// Cache data for one day by default
$frontCache = new Phalcon\Cache\Frontend\Data(array(
'lifetime' => 86400 * 24
));
// If the has redis enabled, use redis for cache
if ($config->redis->enable) {
$redis = new Redis();
$redis->connect($config->redis->host, $config->redis->port);
// It is work properly here
$redis->set('love', 'foo');
die();
// But when I use Phalcon Incubator's Redis cache backend
// It says "Cannot connect to Redisd server"
$backRedis = new \Phalcon\Cache\Backend\Redis($frontCache, array(
'redis' => $redis,
'prefix' => 'wwp-cache-'
));
$backRedis->save('love', 'foo');
echo $backRedis->get('love');
die();
}
Does anybody know why?
I'm working on Phalcon 2.0