Lines Matching full:cache

14 use Twig\Cache\CacheInterface;
15 use Twig\Cache\FilesystemCache;
16 use Twig\Cache\NullCache;
52 private $cache; variable in Twig\\Environment
81 * * cache: An absolute path where to store the compiled templates,
82 * a \Twig\Cache\CacheInterface implementation,
83 * or false to disable compilation cache (default).
112 'cache' => false,
125 $this->setCache($options['cache']);
243 * Gets the current cache implementation.
245 * @param bool $original Whether to return the original cache option or the real cache instance
247 * @return CacheInterface|string|false A Twig\Cache\CacheInterface implementation,
249 * or false to disable cache
253 return $original ? $this->originalCache : $this->cache;
257 * Sets the current cache implementation.
259 * @param CacheInterface|string|false $cache A Twig\Cache\CacheInterface implementation,
261 * or false to disable cache
263 public function setCache($cache) argument
265 if (\is_string($cache)) {
266 $this->originalCache = $cache;
267 $this->cache = new FilesystemCache($cache);
268 } elseif (false === $cache) {
269 $this->originalCache = $cache;
270 $this->cache = new NullCache();
271 } elseif ($cache instanceof CacheInterface) {
272 $this->originalCache = $this->cache = $cache;
274 …throw new \LogicException('Cache can only be a string, false, or a \Twig\Cache\CacheInterface impl…
283 * * The cache key for the given template;
342 * @throws RuntimeError When a previously generated cache is corrupted
374 * @throws RuntimeError When a previously generated cache is corrupted
399 $key = $this->cache->generateKey($name, $mainCls);
401 … if (!$this->isAutoReload() || $this->isTemplateFresh($name, $this->cache->getTimestamp($key))) {
402 $this->cache->load($key);
409 $this->cache->write($key, $content);
410 $this->cache->load($key);
414 * $this->cache is implemented as a no-op or we have a race condition
415 * where the cache was cleared between the above calls to write to and load from
416 * the cache.
422 … new RuntimeError(sprintf('Failed to load Twig template "%s", index "%s": cache might be corrupted…