You are here

public function TwigPhpStorageCache::generateKey in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Core/Template/TwigPhpStorageCache.php \Drupal\Core\Template\TwigPhpStorageCache::generateKey()

File

core/lib/Drupal/Core/Template/TwigPhpStorageCache.php, line 74
Contains \Drupal\Core\Template\TwigPhpStorageCache.

Class

TwigPhpStorageCache
Provides an alternate cache storage for Twig using PhpStorage.

Namespace

Drupal\Core\Template

Code

public function generateKey($name, $className) {
  $hash = hash('sha256', $className);
  if (strpos($name, '{# inline_template_start #}') === 0) {

    // $name is an inline template, and can have characters that are not valid
    // for a filename. $hash is unique for each inline template so we just use
    // the generic name 'inline-template' here.
    $name = 'inline-template';
  }
  else {
    $name = basename($name);
  }

  // The first part is what is invalidated.
  return $this->templateCacheFilenamePrefix . '_' . $name . '_' . $hash;
}