lithium\storage\cache\adapter\Redis::_init()
Overrides
lithium\core\Object::_init()
Initialize the Redis connection object, connect to the Redis server and sets prefix using the scope if provided.
Returns
voidSource
protected function _init() {
if (!$this->connection) {
$this->connection = new RedisCore();
}
list($address, $port) = $this->_formatHost($this->_config['host']);
$method = $this->_config['persistent'] ? 'pconnect' : 'connect';
if ($port) {
$this->connection->{$method}($address, $port);
} else {
$this->connection->{$method}($address);
}
if ($this->_config['scope']) {
$this->connection->setOption(RedisCore::OPT_PREFIX, "{$this->_config['scope']}:");
}
}