function CacheTagsChecksumDecorator::isValid

Same name and namespace in other branches
  1. 10 core/modules/system/tests/modules/performance_test/src/Cache/CacheTagsChecksumDecorator.php \Drupal\performance_test\Cache\CacheTagsChecksumDecorator::isValid()

Overrides CacheTagsChecksumInterface::isValid

File

core/modules/system/tests/modules/performance_test/src/Cache/CacheTagsChecksumDecorator.php, line 38

Class

CacheTagsChecksumDecorator
Wraps an existing cache tags checksum invalidator to track calls separately.

Namespace

Drupal\performance_test\Cache

Code

public function isValid($checksum, array $tags) {
    // If there are no cache tags, the cache item is always valid, and the child
    // method will be a no-op, so don't log anything.
    if (empty($tags)) {
        return $this->checksumInvalidator
            ->isValid($checksum, $tags);
    }
    $start = microtime(TRUE);
    $return = $this->checksumInvalidator
        ->isValid($checksum, $tags);
    $stop = microtime(TRUE);
    $this->logCacheTagOperation($tags, $start, $stop, CacheTagOperation::IsValid);
    return $return;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.