You are here

public function DatabaseCacheTagsChecksum::isValid in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php \Drupal\Core\Cache\DatabaseCacheTagsChecksum::isValid()

Returns whether the checksum is valid for the given cache tags.

Used when retrieving a cache item in a cache backend, to verify that no cache tag based invalidation happened.

Parameters

int $checksum: The checksum that was stored together with the cache item.

string[] $tags: The cache tags that were stored together with the cache item.

Return value

bool FALSE if cache tag invalidations happened for the passed in tags since the cache item was stored, TRUE otherwise.

Overrides CacheTagsChecksumInterface::isValid

File

core/lib/Drupal/Core/Cache/DatabaseCacheTagsChecksum.php, line 97
Contains \Drupal\Core\Cache\DatabaseCacheTagsChecksum.

Class

DatabaseCacheTagsChecksum
Cache tags invalidations checksum implementation that uses the database.

Namespace

Drupal\Core\Cache

Code

public function isValid($checksum, array $tags) {
  return $checksum == $this
    ->calculateChecksum($tags);
}