/** * Last update time. * * @param string $key * @return int */ public function getTimestamp($key) { if (!$this->environment->cachable()) { //Always expired return 0; } if ($this->files->exists($key)) { return $this->files->time($key); } return 0; }
/** * {@inheritdoc} * * @return $this */ public function setEnvironment(EnvironmentInterface $environment) { $this->environment = $environment; if (!$environment->cachable()) { $this->twig->setCache(false); return $this; } $this->twig->setCache(new TwigCache($this->files, $environment)); return $this; }