doInvalidateTags example

/** * Callback to be invoked just after a database transaction gets committed. * * Executes all delayed tag invalidations. * * @param bool $success * Whether or not the transaction was successful. */
  public function rootTransactionEndCallback($success) {
    if ($success) {
      $this->doInvalidateTags($this->delayedTags);
    }
    $this->delayedTags = [];
  }

  /** * Implements \Drupal\Core\Cache\CacheTagsInvalidatorInterface::invalidateTags() */
  public function invalidateTags(array $tags) {
    // Only invalidate tags once per request unless they are written again.     foreach ($tags as $key => $tag) {
      if (isset($this->invalidatedTags[$tag])) {
        
Home | Imprint | This part of the site doesn't use cookies.