Lines Matching full:cache

14 use Twig\Cache\CacheInterface;
15 use Twig\Cache\FilesystemCache;
16 use Twig\Cache\NullCache;
55 protected $cache; variable in Twig\\Environment
101 * * cache: An absolute path where to store the compiled templates,
102 * a \Twig\Cache\CacheInterface implementation,
103 * or false to disable compilation cache (default).
137 'cache' => false,
147 $this->setCache($options['cache']);
276 * Gets the current cache implementation.
278 * @param bool $original Whether to return the original cache option or the real cache instance
280 * @return CacheInterface|string|false A Twig\Cache\CacheInterface implementation,
282 * or false to disable cache
286 return $original ? $this->originalCache : $this->cache;
290 * Sets the current cache implementation.
292 * @param CacheInterface|string|false $cache A Twig\Cache\CacheInterface implementation,
294 * or false to disable cache
296 public function setCache($cache) argument
298 if (\is_string($cache)) {
299 $this->originalCache = $cache;
300 $this->cache = new FilesystemCache($cache);
301 } elseif (false === $cache) {
302 $this->originalCache = $cache;
303 $this->cache = new NullCache();
304 } elseif (null === $cache) {
305 …@trigger_error('Using "null" as the cache strategy is deprecated since version 1.23 and will be re…
307 $this->cache = new NullCache();
308 } elseif ($cache instanceof CacheInterface) {
309 $this->originalCache = $this->cache = $cache;
311 …throw new \LogicException(sprintf('Cache can only be a string, false, or a \Twig\Cache\CacheInterf…
316 * Gets the cache filename for a given template.
320 * @return string|false The cache file name or false when caching is disabled
328 $key = $this->cache->generateKey($name, $this->getTemplateClass($name));
338 * * The cache key for the given template;
409 * @throws RuntimeError When a previously generated cache is corrupted
439 * @throws RuntimeError When a previously generated cache is corrupted
467 $key = $this->cache->generateKey($name, $mainCls);
470 … if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) {
471 $this->cache->load($key);
487 $this->cache->write($key, $content);
488 $this->cache->load($key);
493 * $this->cache is implemented as a no-op or we have a race condition
494 * where the cache was cleared between the above calls to write to and load from
495 * the cache.
502 … new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted…
632 * Clears the internal template cache.
644 * Clears the template cache files on the filesystem.
1626 $this->cache->write($file, $content);