You are here

public function AgeTracker::wasCacheClearedBetweenLastTwoRequests in Pantheon Advanced Page Cache 8

File

tests/behat/helper_classes/AgeTracker.php, line 48

Class

AgeTracker

Namespace

PantheonSystems\CDNBehatHelpers

Code

public function wasCacheClearedBetweenLastTwoRequests($path) {

  // Assign the headers to a new variable so that $this->headers is not modified by array_pop().
  $headers = $this->headers[$path];
  $most_recent = array_pop($headers);
  $second_most_recent = array_pop($headers);

  // If the age header on the most recent request is smaller than the age header on the second most recent
  // Then the cache was cleared (@todo, or it expired (account for max age))
  $return = (int) $most_recent['age'] < (int) $second_most_recent['age'];
  return $return;
}