/** * {@inheritdoc} * * @return string Cached filename. */ public function compile($path, $reset = false) { $cached = $this->cache->generateKey($path); if ($this->loader->isFresh($path, $this->cache->getTimestamp($cached)) && !$reset) { //Compiled and cached return $cached; } $benchmark = $this->benchmark('compile', $path); try { $source = $this->supervisor()->createNode($path)->compile(); } finally { $this->benchmark($benchmark); } $benchmark = $this->benchmark('cache', $path); try { //To simplify processors life let's write file to cache first (this might help in debugging) $this->cache->write($cached, $source); //Ok, now we can apply processors $this->cache->write($cached, $this->processSource($source, $path, $cached)); } finally { $this->benchmark($benchmark); } return $cached; }
/** * {@inheritdoc} */ public function isFresh($name, $time) { return $this->loader->isFresh($name, $time); }