@param string $cacheFile

@return Router
487176
public function setCacheFile(string $cacheFile) : Router
    {
        if ($cacheFile == '') {
            $this->cacheFile = false;

            return $this;
        }

        $spl    = new \SplFileInfo($cacheFile);
        $splDir = $spl->getPathInfo();
        if (! $splDir->isWritable()) {
            throw new \RuntimeException(
                'Cache file directory is not writable',
                E_WARNING
            );
        }
        if ($spl->getRealPath() && ! $spl->isFile()) {
            throw new \RuntimeException(
                sprintf(
                    'Cache file is not a file %s given',
                    $spl->getType()
                ),
                E_WARNING
            );
        }

        if (! $spl->getRealPath()) {
            $spl = new \SplFileInfo($splDir->getRealPath() . DIRECTORY_SEPARATOR . $spl->getBasename());
        }

        $this->cacheFile = $spl->__toString();
        unset($spl, $splDir);

        return $this;
    }
1012377
public function setCachePath(string $cachePath)
    {
        $this->cachePath = $cachePath;
        if (!is_dir($this->cachePath)) {
            FileHelper::createDirectory($this->cachePath, $this->dirMode, true);
        }
    }
368731
public static function getCachingClient($cacheDir = null)
	{
		$client = new Cached(self::getClient());
		$client->cacheDir = (isset($cacheDir)) ? $cacheDir : sys_get_temp_dir();

		return $client;
	}
502924
protected function generateCacheFile($file)
    {
        $cacheSalt = serialize(array(
            $this->request->options,
            MUNEE_USING_URL_REWRITE,
            MUNEE_DISPATCHER_FILE
        ));
        $params = serialize($this->request->params);
        $ext = pathinfo($file, PATHINFO_EXTENSION);

        $fileHash = md5($file);
        $optionsHash = md5($params . $cacheSalt);

        $cacheDir = $this->cacheDir . DS . substr($fileHash, 0, 2);

        Utils::createDir($cacheDir);

        return $cacheDir . DS . substr($fileHash, 2) . '-' . $optionsHash . '.' . $ext;
    }
167771
public static function setCachePath($pathCacheFile)
    {
        self::$cacheEnable = false;

        if (!empty($pathCacheFile) && file_exists($pathCacheFile)) {
            self::$cacheEnable = true;
            self::$cachePath   = $pathCacheFile;
        }
        elseif (!empty($pathCacheFile) && !file_exists(dirname($pathCacheFile))) {
            self::$cacheEnable = false;
            self::$cachePath   = $pathCacheFile;
        }
        elseif (!empty($pathCacheFile) && touch($pathCacheFile)) {
            unlink($pathCacheFile);
            self::$cacheEnable = true;
            self::$cachePath   = $pathCacheFile;
        }
    }
1263926
public function read($cacheFile, $vars = [])
    {
        if (!empty($vars) && is_array($vars)) {
            // 模板阵列变量分解成为独立变量
            if (isset($vars['cacheFile'])) {
                $_think_cacheFile = $cacheFile;
                $cacheFile        = $vars['cacheFile'];
                unset($vars['cacheFile'], $vars['_think_cacheFile']);
                extract($vars);
                include $_think_cacheFile;
                return;
            }
            extract($vars);
        }

        //载入模版缓存文件
        include $cacheFile;
    }
1080973
protected function getCache(): PhpFileCache
    {
        if ($this->_cache === null)
            $this->_cache = new PhpFileCache($this->getCacheDir());

        return $this->_cache;
    }
988709
public function setCachePath($cachePath = NULL)
    {
        $this->cachePath = $cachePath;
        $this->debug->debug(__FUNCTION__, 'setCachePath: ', $this->cachePath);
    }
589836
public static function getRoute($path, $cachedResponse = true) {
		$path = self::slashPath ( $path );
		if (isset ( self::$routes [$path] )) {
			return self::getRoute_ ( self::$routes [$path], $path, [ $path ], $cachedResponse );
		}
		foreach ( self::$routes as $routePath => $routeDetails ) {
			if (preg_match ( "@^" . $routePath . "$@s", $path, $matches )) {
				if (($r = self::getRoute_ ( $routeDetails, $routePath, $matches, $cachedResponse )) !== false) {
					return $r;
				}
			}
		}
		Logger::warn ( "Router", "No route found for {$path}", "getRoute" );
		return false;
	}
136168
protected function writeFile(string $cacheFile, string $contents): bool
    {
        $dir = dirname($cacheFile);

        if ($dir !== $this->cacheDir && !is_dir($dir)) {
            mkdir($dir, 0775, true);
        }

        return (bool)file_put_contents($cacheFile, $contents);
    }
546563
public function setCacheProvider(\Doctrine\Common\Cache\Cache $cacheProvider = null)
    {
        $this->cacheProvider = $cacheProvider;

        return $this;
    }
83639
public static function createPathFromUrl( $url, $cacheLocation )
	{
		$parts = parse_url( $url );

		$path = str_replace( '\\', '/', rtrim( $cacheLocation, '\\/' ) );

		if ( isset( $parts['scheme'] ) ) $path .= "/{$parts['scheme']}";
		if ( isset( $parts['host'] ) ) $path .= "/{$parts['host']}";
		if ( isset( $parts['path'] ) ) $path .= "/{$parts['path']}";

		return $path;
	}
554220
public function getMatchedRule($cacheRule = null)
    {
        $request = $this->getRequest();

        if (!empty($cacheRule)) {
            if (isset($this->cacheRules[$cacheRule])) {
                $cr = $this->cacheRules[$cacheRule];
                $cacheKey = $cr->match($request);

                return new MatchedRule(clone $cr, $cacheKey);
            }
        } else {
            foreach ($this->cacheRules as $cr) {
                if (($cacheKey = $cr->match($request))) {
                    return new MatchedRule(clone $cr, $cacheKey);
                }
            }
        }


        return false;
    }
458727
public static function get(CacheItemPoolInterface $pool, RouterInterface $router, array $config)
    {
        if ($config['use_tagging']) {
            $pool = TaggablePSR6PoolAdapter::makeTaggable($pool);
        }

        if (!empty($config['prefix'])) {
            $pool = new PrefixedCachePool($pool, $config['prefix']);
        }

        return new CachingRouter($pool, $router, $config);
    }
1280336
protected function fetch($templateFile='',$content='',$prefix='') {
        return $this->view->fetch($templateFile,$content,$prefix);
    }
97787
private function initBaseDir($templateFile)
    {
        $baseDir = Cml::getContainer()->make('cml_route')->getAppName();
        $baseDir && $baseDir .= '/';
        $baseDir .= Cml::getApplicationDir('app_view_path_name') . (Config::get('html_theme') != '' ? DIRECTORY_SEPARATOR . Config::get('html_theme') : '');

        $layOutRootDir = $baseDir;
        if ($templateFile === '') {
            $baseDir .= '/' . Cml::getContainer()->make('cml_route')->getControllerName() . '/';
            $file = Cml::getContainer()->make('cml_route')->getActionName();
        } else {
            $templateFile = str_replace('.', '/', $templateFile);
            $baseDir .= DIRECTORY_SEPARATOR . dirname($templateFile) . DIRECTORY_SEPARATOR;
            $file = basename($templateFile);
        }

        return [
            'layoutDir' => Cml::getApplicationDir('apps_path') . DIRECTORY_SEPARATOR . $layOutRootDir,
            'layoutCacheRootPath' => Cml::getApplicationDir('runtime_cache_path') . DIRECTORY_SEPARATOR . $layOutRootDir . DIRECTORY_SEPARATOR,
            'templateDir' => Cml::getApplicationDir('apps_path') . DIRECTORY_SEPARATOR . $baseDir, //指定模板文件存放目录
            'cacheDir' => Cml::getApplicationDir('runtime_cache_path') . DIRECTORY_SEPARATOR . $baseDir, //指定缓存文件存放目录
            'file' => $file
        ];
    }
908968
public function create($cacheFilePath = null)
    {
        $map = [];
        if ($cacheFilePath) {
            $map = $this->resolveCachedMap($cacheFilePath);
        }
        if (!is_array($map)) {
            $map = $this->createMap();
            if ($cacheFilePath) {
                $this->cacheMap($cacheFilePath, $map);
            }
        }

        $this->map = $map;

        return $map;
    }