/** * returns the cached template output file name, true if it's cache-able but not cached * or false if it's not cached * * @param Core $dwoo the dwoo instance that requests it * * @return string|bool */ public function getCachedTemplate(Core $dwoo) { if ($this->cacheTime !== null) { $cacheLength = $this->cacheTime; } else { $cacheLength = $dwoo->getCacheTime(); } // file is not cacheable if ($cacheLength == 0) { return false; } $cachedFile = $this->getCacheFilename($dwoo); if (isset(self::$cache['cached'][$this->cacheId]) === true && file_exists($cachedFile)) { // already checked, return cache file return $cachedFile; } elseif ($this->compilationEnforced !== true && file_exists($cachedFile) && ($cacheLength === -1 || filemtime($cachedFile) > $_SERVER['REQUEST_TIME'] - $cacheLength) && $this->isValidCompiledFile($this->getCompiledFilename($dwoo))) { // cache is still valid and can be loaded self::$cache['cached'][$this->cacheId] = true; return $cachedFile; } else { // file is cacheable return true; } }