AssetManager\View\Helper\Asset::getFilePathFromCache PHP 메소드

getFilePathFromCache() 개인적인 메소드

Use the cache to get the filePath
private getFilePathFromCache ( string $filename, string $queryString ) : mixed | string
$filename string
$queryString string
리턴 mixed | string
    private function getFilePathFromCache($filename, $queryString)
    {
        // return if cache not found
        if ($this->cache == null) {
            return null;
        }
        // cache key based on the filename
        $cacheKey = md5($filename);
        $itemIsFoundInCache = false;
        $filePath = $this->cache->getItem($cacheKey, $itemIsFoundInCache);
        // if there is no element in the cache, elaborate and cache it
        if ($itemIsFoundInCache === false || $filePath === null) {
            $filePath = $this->elaborateFilePath($filename, $queryString);
            $this->cache->setItem($cacheKey, $filePath);
        }
        return $filePath;
    }