You are here

class DummyTagChecksum in Supercache 8

Same name and namespace in other branches
  1. 2.0.x src/Cache/DummyTagChecksum.php \Drupal\supercache\Cache\DummyTagChecksum

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

Hierarchy

Expanded class hierarchy of DummyTagChecksum

5 files declare their use of DummyTagChecksum
ApcuRawBackendGeneralTestCaseTrait.php in src/Tests/Cache/ApcuRawBackendGeneralTestCaseTrait.php
ChainedStorage.php in src/KeyValueStore/ChainedStorage.php
Contains \Drupal\supercache\KeyValueStore\ChainedStorage;
ChainedStorageExpirable.php in src/KeyValueStore/ChainedStorageExpirable.php
Contains \Drupal\supercache\KeyValueStore\ChainedStorageExpirable.
ChainedStorageTrait.php in src/KeyValueStore/ChainedStorageTrait.php
DatabaseRawBackendGeneralTestCaseTrait.php in src/Tests/Cache/DatabaseRawBackendGeneralTestCaseTrait.php

File

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

Namespace

Drupal\supercache\Cache
View source
class DummyTagChecksum implements CacheTagsChecksumInterface {

  /**
   * {@inheritdoc}
   */
  public function getCurrentChecksum(array $tags) {
    if (!empty($tags)) {
      throw new \Exception("DummyTagChecksum cannot process tags.");
    }

    // Checksum needs to be 0 because the original
    // database storage for tags was designed not
    // to accept NULL.
    return 0;
  }

  /**
   * {@inheritdoc}
   */
  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;
  }

  /**
   * {@inheritdoc}
   */
  public function reset() {
    return;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheTagsChecksumInterface::INVALID_CHECKSUM_WHILE_IN_TRANSACTION constant The invalid checksum returned if a database transaction is in progress.
DummyTagChecksum::getCurrentChecksum public function Returns the sum total of validations for a given set of tags. Overrides CacheTagsChecksumInterface::getCurrentChecksum
DummyTagChecksum::isValid public function Returns whether the checksum is valid for the given cache tags. Overrides CacheTagsChecksumInterface::isValid
DummyTagChecksum::reset public function Reset statically cached tags. Overrides CacheTagsChecksumInterface::reset