Exemplo n.º 1
0
 public function testLoad()
 {
     $cache = new Filesystem(__DIR__, true);
     $time = date('c');
     $cache->write(__DIR__ . '/test', '<?php return "' . $time . '";', [new FileResource(__DIR__ . '/../Fixtures/Resources/views/main.hbs')]);
     $this->assertSame($time, $cache->load(__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);
 }