public function onComplete(CompleteEvent $event, $name)
    {
        $request = $event->getRequest();
        $response = $event->getResponse();

        if($request->getMethod() == 'GET' && $response->getStatusCode() == 200 && $this->lifetime)
        {
            $response_key = $this->getCacheResponseKey($request->getUrl());
            $body_key = $this->getCacheBodyKey($request->getUrl());

            if(! $this->cache->has($response_key) || ! $this->cache->has($body_key))
            {
                $body = (string) $response->getBody();
                $this->cache->put($response_key, $response, $this->lifetime);
                $this->cache->put($body_key, $body, $this->lifetime);
            }
        }
    }
public function onComplete(CompleteEvent $event, $name)
    {
        $request = $event->getRequest();
        $response = $event->getResponse();

        if($request->getMethod() == 'GET' && $response->getStatusCode() == 200 && $this->lifetime)
        {
            $response_key = $this->getCacheResponseKey($request->getUrl());
            $body_key = $this->getCacheBodyKey($request->getUrl());

            if(! $this->cache->has($response_key) || ! $this->cache->has($body_key))
            {
                $body = (string) $response->getBody();
                $this->cache->put($response_key, $response, $this->lifetime);
                $this->cache->put($body_key, $body, $this->lifetime);
            }
        }
    }
public function onComplete ( CompleteEvent $ event , $ name ) { $ request = $ event -> getRequest ( ) ; $ response = $ event -> getResponse ( ) ; if ( $ request -> getMethod ( ) == 'GET' && $ response -> getStatusCode ( ) == 200 && $ this -> lifetime ) { $ response_key = $ this -> getCacheResponseKey ( $ request -> getUrl ( ) ) ; $ body_key = $ this -> getCacheBodyKey ( $ request -> getUrl ( ) ) ; if ( ! $ this -> cache -> has ( $ response_key ) || ! $ this -> cache -> has ( $ body_key ) ) { $ body = ( string ) $ response -> getBody ( ) ; $ this -> cache -> put ( $ response_key , $ response , $ this -> lifetime ) ; $ this -> cache -> put ( $ body_key , $ body , $ this -> lifetime ) ; } } }
Store completed request in the cache

@param  CompleteEvent $event
@param  [type]        $name  [description]
@return void
Store completed request in the cache