You are here

public function DummyTagChecksum::isValid in Supercache 8

Same name and namespace in other branches
  1. 2.0.x src/Cache/DummyTagChecksum.php \Drupal\supercache\Cache\DummyTagChecksum::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

src/Cache/DummyTagChecksum.php, line 35
Contains \Drupal\supercache\Cache\DummyTagChecksum.

Class

DummyTagChecksum
Stub checksum interface, for when you need to use a cache backend without tag invalidation support.

Namespace

Drupal\supercache\Cache

Code

public function isValid($checksum, array $tags) {
  if (!empty($tags) || !empty($checksum)) {
    throw new \Exception("DummyTagChecksum cannot process tags and items cannot have a checksum.");
  }
  return TRUE;
}