protected function resolveConnection($name = null)
    {
        $name = $name ?: 'default';
        $options = Arr::get($this->config, 'options', [ ]);

        if (isset($this->config[$name])) {
            return $this->connector()->connect($this->config[$name], $options);
        }

        if (isset($this->config['clusters']['name'])) {
            throw new InvalidArgumentException(
                'Redis Sentinel connections do not support Redis Cluster.'
            );
        }

        throw new InvalidArgumentException(
            'The Redis Sentinel connection [' . $name . '] is not defined.'
        );
    }