TwigPhpStorageCache::generateKey

public TwigPhpStorageCache::generateKey($name, $className)

Generates a cache key for the given template class name.

Parameters

string $name The template name:

string $className The template class name:

Return value

string

Overrides Twig_CacheInterface::generateKey

File

core/lib/Drupal/Core/Template/TwigPhpStorageCache.php, line 69

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;
}
doc_Drupal
2016-10-29 09:49:46
Comments
Leave a Comment

Please login to continue.