function TwigEnvironment::invalidate

Same name in other branches
  1. 8.9.x core/lib/Drupal/Core/Template/TwigEnvironment.php \Drupal\Core\Template\TwigEnvironment::invalidate()
  2. 10 core/lib/Drupal/Core/Template/TwigEnvironment.php \Drupal\Core\Template\TwigEnvironment::invalidate()
  3. 11.x core/lib/Drupal/Core/Template/TwigEnvironment.php \Drupal\Core\Template\TwigEnvironment::invalidate()

Invalidates all compiled Twig templates.

See also

\drupal_flush_all_caches

File

core/lib/Drupal/Core/Template/TwigEnvironment.php, line 139

Class

TwigEnvironment
A class that defines a Twig environment for Drupal.

Namespace

Drupal\Core\Template

Code

public function invalidate() {
    PhpStorageFactory::get('twig')->deleteAll();
    $this->templateClasses = [];
    $this->state
        ->delete(static::CACHE_PREFIX_METADATA_KEY);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.