Creates the cache folder hierarchy and returns the full path to the given cache file.

@param string $cacheKey

@return string
6763
private function getCachePath($cacheKey)
    {
        $folder = $this->cacheDir . substr($cacheKey, 0, 2) . DIRECTORY_SEPARATOR . substr($cacheKey, 2,
                2) . DIRECTORY_SEPARATOR . substr($cacheKey, 4, 2) . DIRECTORY_SEPARATOR;
        if (!is_dir($folder)) {
            mkdir($folder, 0755, true);
        }

        return $folder . $cacheKey;
    }
975290
protected function getCacheFilePath()
    {
        $hash = md5($this->filePath);
        $result = storage_path().'/cms/cache/';
        $result .= substr($hash, 0, 2).'/';
        $result .= substr($hash, 2, 2).'/';
        $result .= basename($this->filePath);
        $result .= '.php';

        return $result;
    }
69415
public static String generateCacheFileFullPath(String url, File cacheDir) {
		String fileName = md5(url);
		File cacheFile = new File(cacheDir, fileName);
		return cacheFile.getPath();
	}
582138
public function cacheFile($cacheKey, $fileContents) {

        // Get directory and filename
        list($directory, $filename) = $this->getDirectoryAndFilenameFromKey($cacheKey);

        // Make the cache directory
        if (!file_exists($directory)) mkdir($directory, 0777, true);

        // Save the file
        file_put_contents($directory . "/" . $filename, $fileContents);

    }
213122
public function getCacheDir()
    {
        $fileSystem = new Filesystem();
        $path = 'var/cache/assets/'.$this->name.'/';
        
        if (!$fileSystem->exists($path)) {
            $fileSystem->mkdir($path);
        }
        
        return $path;
    }
731053
protected function getFromFirstLevelCache($cacheId)
    {
        if (!empty(self::$firstLevelCache[$this->cacheName][$cacheId])) {
            return self::$firstLevelCache[$this->cacheName][$cacheId];
        }

        return null;
    }
1038516
protected function path($key)
	{
		$parts = explode('.', $key);

		$path = array_shift($parts);
		$path = $this->directory . ($path ? DIRECTORY_SEPARATOR . $this->cleanPath($path) : '');

		return $path . DIRECTORY_SEPARATOR . $this->id($key) . '.php';
	}
109014
protected function generateCacheKey(): string
    {
        return sprintf(
            '%s:%s:%s',
            $this->command,
            $this->collection->getNamespace(),
            md5(serialize($this->params))
        );
    }
828411
private function getCacheFilePath($key)
    {
        $hash = hash('sha256', $key);
        $subdir = substr($hash, 0, 2);
        $filename = substr($hash, 2);

        return $this->cacheDir
            . DIRECTORY_SEPARATOR
            . $subdir
            . DIRECTORY_SEPARATOR
            . $filename
        ;
    }
327587
private function getCacheFile()
    {
        if (is_null($this->cachePath) || !file_exists($this->cachePath)) {
            $this->error('Invalid Cache Path. '.$this->cachePath);
            return false;
        }
        $cacheKey = is_null($this->cacheKey) ? md5($this->templateFile) : $this->cacheKey;
        return($this->cachePath . $cacheKey);
    }
1131848
protected function getCachePermissions($cacheKey)
    {
        // Check local cache
        if (isset($this->cachePermissions[$cacheKey])) {
            return $this->cachePermissions[$cacheKey];
        }

        // Check persistent cache
        if ($this->cacheService) {
            $result = $this->cacheService->get($cacheKey);

            // Warm local cache
            if ($result) {
                $this->cachePermissions[$cacheKey] = $result;
                return $result;
            }
        }

        return null;
    }
425619
public function find($cacheKey)
    {
        $key = array_search($cacheKey, $this->cachedKeys);

        if ($key != false and ! $this->cache->has($key))
        {
            unset($this->cachedKeys[$key]);
            $this->storeCachedKeys();

            return false;
        }

        return $key ? $this->cache->get($key) : false;
    }
564855
private function getFileName($key) {
		$key = str_replace(' ', '', $key);
		$cacheDir = rtrim($this->cachePath, '\\/') . '/';
		if ($this->directoryLevel > 0) {
			$hash = abs(crc32($key));
			$cacheDir .= $hash % 1024;
			for($i = 1; $i < $this->directoryLevel; ++$i) {
				if (($prefix = substr($hash, $i, 2)) !== false) {
					$cacheDir .= '/' . $prefix;
				}
			}
		}
		return $cacheDir . '/' . md5($key) . $this->cacheExt;
	}
142246
protected function getTargetFile($hashKey)
    {
        if (!$this->started) {
            $this->started = true;
            $this->createDir($this->targetDirectory);
        }

        $hashDir = substr($hashKey, -1);

        $targetDir = $this->targetDirectory . DIRECTORY_SEPARATOR . $hashDir;

        $this->createDir($targetDir);

        return sprintf(
            '%s%s%s.cache.php',
            $targetDir,
            DIRECTORY_SEPARATOR,
            $hashKey
        );
    }
1352139
public function getCachePath(): string
    {
        $path = $this->getRuntimePath() . DIRECTORY_SEPARATOR . 'cache';
        FileHelper::createDirectory($path);
        return $path;
    }
510907
public function purgeCachedFiles($cacheKey) {
        // Get directory and filename
        list($directory, $filename) = $this->getDirectoryAndFilenameFromKey($cacheKey);

        // Remove the directory
        passthru("rm -rf " . $directory . "/" . $filename);

    }
1207596
protected function cacheFile(string $key): string
    {
        return $this->path . '/' . $this->prefix . $key . $this->extension;
    }