Seems like I had a few different problems: igBinary module was not working properly, and the auth parameter doesn't seem to work.
So fixed those 2 issues, but I'd like to push it a bit further...
I want to use Redis for the php sessions and my frontend cache. To make sure those 2 are properly separated, I'd like to use different redis DB but I can't seem to find the right way to set that up.
Now, I've tried to add extra options for my redis connections todefine specific Redis db, prefix, serializer...
So I tried to use $redis->select(DB_NUMBER) , but that doesn't work. Tried to pass extra param in the Option array, not better.
Here is the code I'm currently trying:
$___asConfig['session']= array(
'path' => 'tcp://127.0.0.1:6379?weight=1',
'name' => '',
'lifetime' => 43200, //12hr
'cookie_lifetime' => 0, // infinite
'cookie_secure' => true,
Redis::OPT_SERIALIZER => Redis::SERIALIZER_IGBINARY,
Redis::OPT_PREFIX => '___projectID-Session__'
);
$di->setShared('session', function(){
$oRedis = new Phalcon\Session\Adapter\Redis($___asConfig['session']);
//$oRedis->select(CONF_REDIS_DB_SESSION);
$oRedis->start();
return $oRedis;
});
and for the cache
$asRedisConf = array(
'host' => 'localhost',
'port' => 6379,
'auth' => 'daughter123', // doeasn't work 'auth' => 'daughter123',
'persistent' => false
);
$oCache = function () use($asRedisConf) {
$oFrontCache = new Phalcon\Cache\Frontend\Data(array(
'lifetime' => 36000,
'prefix' => 'fe.'
));
$oRedis = new Phalcon\Cache\Backend\Redis($oFrontCache, array('redis' => $asRedisConf));
//$oRedis->select(CONF_REDIS_DB_CACHE);
return $oRedis;
};
$di->setShared('cache', $oCache);
$di->setShared('viewCache', $oCache);
Has anyone tried to dig deep into Redis config and adapaters ?
Thanks