예제 #1
0
 public function testIsFresh()
 {
     $cache = new Filesystem(__DIR__, true);
     $time = date('c');
     $cache->write(__DIR__ . '/test', $time, [new FileResource(__DIR__ . '/../Fixtures/Resources/views/main.hbs')]);
     $this->assertTrue($cache->isFresh(__DIR__ . '/test'));
 }
 /**
  * @param $templateName
  * @return callable
  */
 public function loadTemplate($templateName)
 {
     $name = (string) $templateName;
     $cacheKey = $this->getCacheFilename($name);
     if (!file_exists($cacheKey) || $this->isAutoReload() && !$this->cache->isFresh($cacheKey)) {
         $this->compile($name);
     }
     return $this->cache->load($cacheKey);
 }