You are here

class VarnishBackend in Varnish 8

Hierarchy

Expanded class hierarchy of VarnishBackend

File

src/Cache/VarnishBackend.php, line 9

Namespace

Drupal\varnish\Cache
View source
class VarnishBackend implements CacheBackendInterface {
  protected $bin;
  protected $pathAliasManager;

  /**
   * Constructs a VarnishBackend object.
   *
   * @param string $bin
   *   The cache bin for which the object is created.
   */
  function __construct($bin, $pathAliasManager) {
    $this->bin = $bin;
    $this->pathAliasManager = $pathAliasManager;
  }

  /**
   * {@inheritdoc}
   */
  public function get($cid, $allow_invalid = FALSE) {
    return FALSE;
  }

  /**
   * {@inheritdoc}
   */
  public function getMultiple(&$cids, $allow_invalid = FALSE) {
    return [];
  }

  /**
   * {@inheritdoc}
   */
  public function set($cid, $data, $expire = Cache::PERMANENT, array $tags = []) {
  }

  /**
   * {@inheritdoc}
   */
  public function setMultiple(array $items) {
  }

  /**
   * {@inheritdoc}
   */
  public function delete($cid) {
    $this
      ->deleteMultiple([
      $cid,
    ]);
  }

  /**
   * {@inheritdoc}
   */
  public function deleteMultiple(array $cids) {
    $test = 'test';
  }

  /**
   * {@inheritdoc}
   */
  public function deleteTags(array $tags) {
    $tag_cache =& drupal_static('Drupal\\Core\\Cache\\CacheBackendInterface::tagCache', []);
    $deleted_tags =& drupal_static('Drupal\\Core\\Cache\\DatabaseBackend::deletedTags', []);
    foreach ($tags as $tag) {

      // Only delete tags once per request unless they are written again.
      if (isset($deleted_tags[$tag])) {
        continue;
      }
      $deleted_tags[$tag] = TRUE;
      unset($tag_cache[$tag]);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function deleteAll() {
    $test = 'test';
  }

  /**
   * {@inheritdoc}
   */
  public function invalidate($cid) {
    $this
      ->invalidateMultiple([
      $cid,
    ]);
  }

  /**
   * {@inheritdoc}
   */
  public function invalidateMultiple(array $cids) {
    $test = 'test';
  }

  /**
   * {@inheritdoc}
   */
  public function invalidateTags(array $tags) {
    $tag_cache =& drupal_static('Drupal\\Core\\Cache\\CacheBackendInterface::tagCache', []);
    $invalidated_tags =& drupal_static('Drupal\\Core\\Cache\\DatabaseBackend::invalidatedTags', []);
    foreach ($tags as $tag) {

      // Only invalidate tags once per request unless they are written again.
      if (isset($invalidated_tags[$tag])) {
        continue;
      }
      $invalidated_tags[$tag] = TRUE;
      unset($tag_cache[$tag]);
    }
  }

  /**
   * {@inheritdoc}
   */
  public function invalidateAll() {
    $test = 'test';
  }

  /**
   * {@inheritdoc}
   */
  public function garbageCollection() {
  }

  /**
   * {@inheritdoc}
   */
  public function removeBin() {
  }

}

Members

Namesort descending Modifiers Type Description Overrides
CacheBackendInterface::CACHE_PERMANENT constant Indicates that the item should never be removed unless explicitly deleted.
VarnishBackend::$bin protected property
VarnishBackend::$pathAliasManager protected property
VarnishBackend::delete public function Deletes an item from the cache. Overrides CacheBackendInterface::delete
VarnishBackend::deleteAll public function Deletes all cache items in a bin. Overrides CacheBackendInterface::deleteAll
VarnishBackend::deleteMultiple public function Deletes multiple items from the cache. Overrides CacheBackendInterface::deleteMultiple
VarnishBackend::deleteTags public function
VarnishBackend::garbageCollection public function Performs garbage collection on a cache bin. Overrides CacheBackendInterface::garbageCollection
VarnishBackend::get public function Returns data from the persistent cache. Overrides CacheBackendInterface::get
VarnishBackend::getMultiple public function Returns data from the persistent cache when given an array of cache IDs. Overrides CacheBackendInterface::getMultiple
VarnishBackend::invalidate public function Marks a cache item as invalid. Overrides CacheBackendInterface::invalidate
VarnishBackend::invalidateAll public function Marks all cache items as invalid. Overrides CacheBackendInterface::invalidateAll
VarnishBackend::invalidateMultiple public function Marks cache items as invalid. Overrides CacheBackendInterface::invalidateMultiple
VarnishBackend::invalidateTags public function
VarnishBackend::removeBin public function Remove a cache bin. Overrides CacheBackendInterface::removeBin
VarnishBackend::set public function Stores data in the persistent cache. Overrides CacheBackendInterface::set
VarnishBackend::setMultiple public function Store multiple items in the persistent cache. Overrides CacheBackendInterface::setMultiple
VarnishBackend::__construct function Constructs a VarnishBackend object.