Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Store.php

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\HttpCache

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal