src/Factory/RedisFactory.php
public function getAdapter(array $config)
    {
        $client = new \Redis();

        $dsn = $this->getDsn();
        if (empty($dsn)) {
            if (false === $client->connect($config['host'], $config['port'])) {
                throw new ConnectException(sprintf('Could not connect to Redis database on "%s:%s".', $config['host'], $config['port']));
            }
        } else {
            if (false === $client->connect($dsn->getFirstHost(), $dsn->getFirstPort())) {
                throw new ConnectException(sprintf('Could not connect to Redis database on "%s:%s".', $dsn->getFirstHost(), $dsn->getFirstPort()));
            }

            if (!empty($dsn->getPassword())) {
                if (false === $client->auth($dsn->getPassword())) {
                    throw new ConnectException('Could not connect authenticate connection to Redis database.');
                }
            }
            $config['database'] = $dsn->getDatabase();
        }

        if (null !== $config['database'] && false === $client->select($config['database'])) {
            throw new ConnectException(sprintf('Could not select Redis database with index "%s".', $config['database']));
        }

        $pool = new RedisCachePool($client);

        if (null !== $config['pool_namespace']) {
            $pool = new NamespacedCachePool($pool, $config['pool_namespace']);
        }

        return $pool;
    }
public function getAdapter(array $config)
    {
        $client = new \Redis();

        $dsn = $this->getDsn();
        if (empty($dsn)) {
            if (false === $client->connect($config['host'], $config['port'])) {
                throw new ConnectException(sprintf('Could not connect to Redis database on "%s:%s".', $config['host'], $config['port']));
            }
        } else {
            if (false === $client->connect($dsn->getFirstHost(), $dsn->getFirstPort())) {
                throw new ConnectException(sprintf('Could not connect to Redis database on "%s:%s".', $dsn->getFirstHost(), $dsn->getFirstPort()));
            }

            if (!empty($dsn->getPassword())) {
                if (false === $client->auth($dsn->getPassword())) {
                    throw new ConnectException('Could not connect authenticate connection to Redis database.');
                }
            }
            $config['database'] = $dsn->getDatabase();
        }

        if (null !== $config['database'] && false === $client->select($config['database'])) {
            throw new ConnectException(sprintf('Could not select Redis database with index "%s".', $config['database']));
        }

        $pool = new RedisCachePool($client);

        if (null !== $config['pool_namespace']) {
            $pool = new NamespacedCachePool($pool, $config['pool_namespace']);
        }

        return $pool;
    }
{@inheritdoc}