cacheFlush example

// Invalidate the views cache tags in order to invalidate the render     // caching.     \Drupal::service('cache_tags.invalidator')->invalidateTags($view->storage->getCacheTagsToInvalidate());
    $build = $view->buildRenderable();
    $renderer->renderPlain($build);

    // Test the cacheFlush method invalidates the cache.     $cache_plugin = $view->display_handler->getPlugin('cache');
    $this->assertTrue($cache_plugin->cacheGet('results'), 'Results cache found.');
    $this->assertNotEmpty($this->getRenderCache($view), 'Output cache found.');

    $cache_plugin->cacheFlush();

    $cache_plugin = $view->display_handler->getPlugin('cache');
    $this->assertFalse($cache_plugin->cacheGet('results'), 'Results cache empty after the cacheFlush() method is called.');
    $this->assertFalse($this->getRenderCache($view), 'Output cache empty after the cacheFlush() method is called.');
  }

}
$extender->validateOptionsForm($form$form_state);
    }
  }

  /** * {@inheritdoc} */
  public function submitOptionsForm(&$form, FormStateInterface $form_state) {
    // Not sure I like this being here, but it seems (?) like a logical place.     $cache_plugin = $this->getPlugin('cache');
    if ($cache_plugin) {
      $cache_plugin->cacheFlush();
    }

    $section = $form_state->get('section');
    switch ($section) {
      case 'display_id':
        if ($form_state->hasValue('display_id')) {
          $this->display['new_id'] = $form_state->getValue('display_id');
        }
        break;

      case 'display_title':
        
Home | Imprint | This part of the site doesn't use cookies.