public function consume($url, Provider $provider = null, $format = self::FORMAT_DEFAULT)
    {
        if ($this->requestParameters instanceof RequestParameters) {
            $cacheKey = sha1($url . json_encode($this->requestParameters->toArray()));
        } else {
            $cacheKey = sha1($url);
        }

        // Check if the resource is cached
        if ($this->resourceCache->has($cacheKey)) {
            return $this->resourceCache->get($cacheKey);
        }

        try {
            // Try to find a provider matching the supplied URL if no one has been supplied.
            if (!$provider) {
                $provider = $this->findProviderForUrl($url);
            }

            if ($provider instanceof Provider) {
                // If a provider was supplied or we found one, store the endpoint URL.
                $endPoint = $provider->getEndpoint();
            } else {
                // If no provider was found, try to discover the endpoint URL.
                $discover = new Discoverer();
                $endPoint = $discover->getEndpointForUrl($url);
            }

            $requestUrl = $this->buildOEmbedRequestUrl($url, $endPoint, $format);
            $content = $this->browser->getContent($requestUrl);

            $methodName = 'process' . ucfirst(strtolower($format)) . 'Response';

            $resource = $this->$methodName($content);

            // Save the resource in cache
            $this->resourceCache->set($cacheKey, $resource);
        } catch (Exception $exception) {
            $this->systemLogger->logException($exception);
            $resource = null;
        }

        return $this->postProcessResource($resource);
    }