private function canSave(RequestInterface $request, ResponseInterface $response)
    {
        if ($request->getMethod() !== 'GET') {
            return false;
        }

        if ($response->getStatusCode() !== 200) {
            return false;
        }

        if (!$this->appendQuery && !empty($request->getUri()->getQuery())) {
            return false;
        }

        if ($response->hasHeader('location')) {
            return false;
        }

        $cacheControl = $response->getHeaderLine('Cache-Control');

        if ($cacheControl && (stripos($cacheControl, 'no-cache') !== false || stripos($cacheControl, 'no-store') !== false)) {
            return false;
        }

        return true;
    }
private function canSave(RequestInterface $request, ResponseInterface $response)
    {
        if ($request->getMethod() !== 'GET') {
            return false;
        }

        if ($response->getStatusCode() !== 200) {
            return false;
        }

        if (!$this->appendQuery && !empty($request->getUri()->getQuery())) {
            return false;
        }

        if ($response->hasHeader('location')) {
            return false;
        }

        $cacheControl = $response->getHeaderLine('Cache-Control');

        if ($cacheControl && (stripos($cacheControl, 'no-cache') !== false || stripos($cacheControl, 'no-store') !== false)) {
            return false;
        }

        return true;
    }
private function canSave ( RequestInterface $ request , ResponseInterface $ response ) { if ( $ request -> getMethod ( ) !== 'GET' ) { return false ; } if ( $ response -> getStatusCode ( ) !== 200 ) { return false ; } if ( ! $ this -> appendQuery && ! empty ( $ request -> getUri ( ) -> getQuery ( ) ) ) { return false ; } if ( $ response -> hasHeader ( 'location' ) ) { return false ; } $ cacheControl = $ response -> getHeaderLine ( 'Cache-Control' ) ; if ( $ cacheControl && ( stripos ( $ cacheControl , 'no-cache' ) !== false || stripos ( $ cacheControl , 'no-store' ) !== false ) ) { return false ; } return true ; }
Check whether the response can be saved or not.

@param RequestInterface  $request
@param ResponseInterface $response

@return bool
Check whether the response can be saved or not .