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;
}