src/Guzzle/Plugin/Cache/CachePlugin.php
public function onRequestException(Event $event)
    {
        if (!$event['exception'] instanceof CurlException) {
            return;
        }

        $request = $event['request'];
        if (!$this->canCache->canCacheRequest($request)) {
            return;
        }

        if ($response = $this->storage->fetch($request)) {
            $response->setHeader('Age', time() - strtotime($response->getDate() ? : 'now'));
            if (!$this->canResponseSatisfyFailedRequest($request, $response)) {
                return;
            }
            $request->getParams()->set('cache.hit', 'error');
            $request->setResponse($response);
            $this->addResponseHeaders($request, $response);
            $event->stopPropagation();
        }
    }
public function onRequestException(Event $event)
    {
        if (!$event['exception'] instanceof CurlException) {
            return;
        }

        $request = $event['request'];
        if (!$this->canCache->canCacheRequest($request)) {
            return;
        }

        if ($response = $this->storage->fetch($request)) {
            $response->setHeader('Age', time() - strtotime($response->getDate() ? : 'now'));
            if (!$this->canResponseSatisfyFailedRequest($request, $response)) {
                return;
            }
            $request->getParams()->set('cache.hit', 'error');
            $request->setResponse($response);
            $this->addResponseHeaders($request, $response);
            $event->stopPropagation();
        }
    }
public function onRequestException ( Event $ event ) { if ( ! $ event [ 'exception' ] instanceof CurlException ) { return ; } $ request = $ event [ 'request' ] ; if ( ! $ this -> canCache -> canCacheRequest ( $ request ) ) { return ; } if ( $ response = $ this -> storage -> fetch ( $ request ) ) { $ response -> setHeader ( 'Age' , time ( ) - strtotime ( $ response -> getDate ( ) ? : 'now' ) ) ; if ( ! $ this -> canResponseSatisfyFailedRequest ( $ request , $ response ) ) { return ; } $ request -> getParams ( ) -> set ( 'cache.hit' , 'error' ) ; $ request -> setResponse ( $ response ) ; $ this -> addResponseHeaders ( $ request , $ response ) ; $ event -> stopPropagation ( ) ; } }
If possible, set a cache response on a cURL exception

@param Event $event

@return null
If possible set a cache response on a cURL exception