private function isCacheable($method, $uri, array $options, $response)
    {
        /** @var ResponseInterface $statusCode */
        $statusCode = $response->getStatusCode();

        //cache only 2** responses
        if ($statusCode < 200 || $statusCode >= 300) {
            return false;
        }

        //GET is always safe to cache
        if ('GET' === $method) {
            return true;
        }

        //POST may be cached for certain endpoints only (forgive us Roy Fielding)
        if ('POST' === $method) {
            return in_array($uri, self::CACHEABLE_POST_ENDPOINTS);
        }

        //assume not cacheable in all other cases
        return false;
    }
private function isCacheable($method, $uri, array $options, $response)
    {
        /** @var ResponseInterface $statusCode */
        $statusCode = $response->getStatusCode();

        //cache only 2** responses
        if ($statusCode < 200 || $statusCode >= 300) {
            return false;
        }

        //GET is always safe to cache
        if ('GET' === $method) {
            return true;
        }

        //POST may be cached for certain endpoints only (forgive us Roy Fielding)
        if ('POST' === $method) {
            return in_array($uri, self::CACHEABLE_POST_ENDPOINTS);
        }

        //assume not cacheable in all other cases
        return false;
    }
private function isCacheable ( $ method , $ uri , array $ options , $ response ) { /** @var ResponseInterface $statusCode */ $ statusCode = $ response -> getStatusCode ( ) ; //cache only 2** responses if ( $ statusCode < 200 || $ statusCode >= 300 ) { return false ; } //GET is always safe to cache if ( 'GET' === $ method ) { return true ; } //POST may be cached for certain endpoints only (forgive us Roy Fielding) if ( 'POST' === $ method ) { return in_array ( $ uri , self :: CACHEABLE_POST_ENDPOINTS ) ; } //assume not cacheable in all other cases return false ; }
Checks if the request may be cached.

@param string $method
@param string $uri
@param array  $options
@param mixed  $response

@return bool
Checks if the request may be cached .