lithium\storage\cache\adapter\Redis::_init PHP Method

_init() protected method

Initialize the Redis connection object, connect to the Redis server and sets prefix using the scope if provided.
protected _init ( ) : void
return void
    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']}:");
        }
    }