function CacheTagsChecksumDecorator::getCurrentChecksum

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::getCurrentChecksum()

Returns the sum total of validations for a given set of tags.

Called by a backend when storing a cache item.

Parameters

string[] $tags: Array of cache tags.

Return value

string Cache tag invalidations checksum.

Overrides CacheTagsChecksumInterface::getCurrentChecksum

File

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

Class

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

Namespace

Drupal\performance_test\Cache

Code

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

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