function Store::requestsMatch
Determines whether two Request HTTP header sets are non-varying based on the vary response header value provided.
Parameters
string|null $vary A Response vary header:
array $env1 A Request HTTP header array:
array $env2 A Request HTTP header array:
2 calls to Store::requestsMatch()
- Store::lookup in vendor/
symfony/ http-kernel/ HttpCache/ Store.php - Locates a cached Response for the Request provided.
- Store::write in vendor/
symfony/ http-kernel/ HttpCache/ Store.php - Writes a cache entry to the store for the given Request and Response.
File
-
vendor/
symfony/ http-kernel/ HttpCache/ Store.php, line 279
Class
- Store
- Store implements all the logic for storing cache metadata (Request and Response headers).
Namespace
Symfony\Component\HttpKernel\HttpCacheCode
private function requestsMatch(?string $vary, array $env1, array $env2) : bool {
if (!$vary) {
return true;
}
foreach (preg_split('/[\\s,]+/', $vary) as $header) {
$key = str_replace('_', '-', strtolower($header));
$v1 = $env1[$key] ?? null;
$v2 = $env2[$key] ?? null;
if ($v1 !== $v2) {
return false;
}
}
return true;
}