protected function createMongodbDriver(array $config): MongoDBCachePool
    {
        if (isset($config['username'], $config['password'])) {
            $dns = \sprintf(
                'mongodb://%s:%s@%s:%s',
                $config['username'],
                $config['password'],
                $config['server'],
                $config['port']
            );
        } else {
            $dns = \sprintf('mongodb://%s:%s', $config['server'], $config['port']);
        }

        $collection = MongoDBCachePool::createCollection(
            new MongoDBManager($dns),
            $config['database'],
            $config['prefix']
        );

        return new MongoDBCachePool($collection);
    }
protected function createMongodbDriver(array $config): MongoDBCachePool
    {
        if (isset($config['username'], $config['password'])) {
            $dns = \sprintf(
                'mongodb://%s:%s@%s:%s',
                $config['username'],
                $config['password'],
                $config['server'],
                $config['port']
            );
        } else {
            $dns = \sprintf('mongodb://%s:%s', $config['server'], $config['port']);
        }

        $collection = MongoDBCachePool::createCollection(
            new MongoDBManager($dns),
            $config['database'],
            $config['prefix']
        );

        return new MongoDBCachePool($collection);
    }
protected function createMongodbDriver ( array $ config ) : MongoDBCachePool { if ( isset ( $ config [ 'username' ] , $ config [ 'password' ] ) ) { $ dns = \ sprintf ( 'mongodb://%s:%s@%s:%s' , $ config [ 'username' ] , $ config [ 'password' ] , $ config [ 'server' ] , $ config [ 'port' ] ) ; } else { $ dns = \ sprintf ( 'mongodb://%s:%s' , $ config [ 'server' ] , $ config [ 'port' ] ) ; } $ collection = MongoDBCachePool :: createCollection ( new MongoDBManager ( $ dns ) , $ config [ 'database' ] , $ config [ 'prefix' ] ) ; return new MongoDBCachePool ( $ collection ) ; }
Create an instance of the MongoDB cache driver.

@param array $config

@throws \MongoDB\Driver\Exception\RuntimeException
@throws \MongoDB\Driver\Exception\InvalidArgumentException

@return \Cache\Adapter\MongoDB\MongoDBCachePool

@codeCoverageIgnore
Create an instance of the MongoDB cache driver .