TwigPhpStorageCache
class TwigPhpStorageCache implements CacheInterface (View source)
Provides an alternate cache storage for Twig using PhpStorage.
This class is designed to work on setups with multiple webheads using a local filesystem for the twig cache. When generating the cache key, a hash value depending on the enabled extensions is included. This prevents stale templates from being reused when twig extensions are enabled or disabled.
Constants
| SUFFIX_SUBSTRING_LENGTH |
The maximum length for each part of the cache key suffix. |
Properties
| protected CacheBackendInterface | $cache | The cache object used for auto-refresh via mtime. |
|
| protected PhpStorageInterface | $storage | The PhpStorage object used for storing the templates. |
|
| protected string | $templateCacheFilenamePrefix | The template cache filename prefix. |
Methods
Store cache backend and other information internally.
Gets the PHP code storage object to use for the compiled Twig files.
{@inheritdoc}
{@inheritdoc}
{@inheritdoc}
{@inheritdoc}
Details
__construct(CacheBackendInterface $cache, string $twig_cache_prefix)
Store cache backend and other information internally.
protected PhpStorageInterface
storage()
Gets the PHP code storage object to use for the compiled Twig files.
generateKey($name, $className)
{@inheritdoc}
load($key)
{@inheritdoc}
write($key, $content)
{@inheritdoc}
getTimestamp($key)
{@inheritdoc}