Get cache filename.

@param string $key Key
@return string Filename
760939
protected function getFilename($key)
    {
        $sha1 = sha1($key);
        $result = $this->path . '/' . substr($sha1, 0, 2) . '/' . substr($sha1, 2) . '.php';

        return $result;
    }
991989
public static function filterCacheKey(string $key): string
    {
        $key = preg_replace('#[/-]#', '.', $key);
        $key = preg_replace('#[^A-Za-z0-9_\.]#', '_', $key);

        return strtolower($key);
    }
992167
protected function getFileName($key)
    {
        $file = $this->getFilePath() . $this->encrypt($key) . $this->fileExtension;

        return $file;
    }
1319605
public function getStoragePath(string $key = null): string
    {
        if (null === $key) {
            $path = $this->dataFolder;
        } else {
            $path = sprintf($this->dataPattern, $this->dataFolder, $key, substr($key, 0, 2));
        }

        return $path;
    }
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;
	}
1041194
public function getCacheFile($cacheKey)
    {
        do_action("before_theme_get_cache_file", $cacheKey);

        $filename = md5($_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] . "-" . $cacheKey);

        do_action("after_theme_get_cache_file", $filename);

        return $this->cachePath . $filename;
    }
349924
public function read($key)
    {
        if (!isset($this->cacheDirectory)) {
            return;
        }

        $this->loadCacheMetaData();

        return unserialize(file_get_contents($this->cacheDirectory . '/' . $key));
    }
772387
public function get($key = '')
    {
        try {
            if ($this->cacheInstance !== NULL && is_object($this->cacheInstance)) {
                /**
                 * @var $cache object
                 */
                if (is_array($key)) {
                    $cache = $this->cacheInstance->getItems($key);
                } else {
                    $cache = $this->cacheInstance->getItem($key);
                }
                if (!$cache->isHit()) {
                    $result = NULL;
                    $this->debug->debug(__FUNCTION__, 'Unavailable Cache for Key: ' . $key);
                } else {
                    $result = $cache->get();
                    $this->debug->debug(__FUNCTION__, 'Get Cache from Key: ' . $key . ', result: ' . json_encode($result));
                }
                $message = 'Final get Content from Key: ' . $key . ' => Output result: ' . json_encode($result);
                $this->debug->info(__FUNCTION__, $message);

                return $result;
            } else {
                $this->debug->error(__FUNCTION__, 'Unavailable cacheInstance');

                return NULL;
            }
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->debug->error(__FUNCTION__, $message);

            return $message;
        }
    }
987037
public function getFilename(string $key): string
    {
        if (!$this->validate($key)) {
            throw new \InvalidArgumentException('The key provided (' . $key . ') is not valid! It may contain only the following characters: "a-z", "0-9", ".", "/", "-" and "_".');
        }
        if ($this->filenameProtocol === null) {
            throw new \Exception('No filenameProtocol specified!');
        }
        return $this->filenameProtocol . '://' . $key;
    }
517859
private function getCacheFileName($name)
    {
        $name = hash($this->options['hash_type'], $name);

        if ($this->options['cache_subdir']) {
            $name = substr($name, 0, 2).DIRECTORY_SEPARATOR.substr($name, 2);
        }

        if ($this->options['prefix']) {
            $name = $this->options['prefix'].DIRECTORY_SEPARATOR.$name;
        }

        $filename = $this->options['path'].$name.'.php';
        $dir      = dirname($filename);
        if (!is_dir($dir)) {
            mkdir($dir, 0755, true);
        }

        return $filename;
    }
295139
protected function getCache($key) {
        $cached = ArrayHelper::getValue($this->cachedData, $key);
        if (!isset($cached)) {
            $cacheData = $this->resolveCacheComponent()->get($this->cacheKeyName);
            $cached = $this->cachedData[$key] = ArrayHelper::getValue($cacheData, $key);
        }
        return $cached;
    }
706474
protected function getPath($key)
    {
        $parsed = $this->parseKey($key);

        array_shift($parsed);

        list ($dir, $file) = $parsed;
        return sprintf('%s/%s/%s', $this->path, $dir, $file);
    }
200518
function use_cache ( $key = '' )
		{
			if (empty($_POST))
			{
				$this->cache_filename  =  $this->cache_dir . 'cache_' . md5($_SERVER['REQUEST_URI'] . serialize($key)) . '.ser';
				if (($_SERVER['HTTP_CACHE_CONTROL'] != 'no-cache')  &&  ($_SERVER['HTTP_PRAGMA'] != 'no-cache')  &&  @is_file($this->cache_filename))
				{
					if ((time() - filemtime($this->cache_filename)) < $this->cache_lifetime)
					{
						readfile($this->cache_filename);
						exit;
					}
				}
				ob_start( array( &$this, 'cache_callback' ) );
			}
		}
4018
private function _filename($key)
    {
        if (true == ($dir_pos = strrpos($key, '/'))) {
            // 有子目录，也可能有多层子目录。
            $cache_name = substr($key, $dir_pos + 1);

            // 缓存目录
            $cache_dir = APP_PATH . '/' . Config::get('cache_dir') . substr($key, 0, $dir_pos) . '/';

            // 递归创建文件夹
            if (!is_dir($cache_dir)) {
                mkdir($cache_dir, 0777, true);
            }
        } else {
            // 无子目录
            $cache_name = $key;
            $cache_dir  = APP_PATH . '/' . Config::get('cache_dir');
        }

        // 缓存文件名
        return $cache_dir . trim($cache_name) . '^' . md5($cache_name) . '.cache';
    }
1129211
public function do_get($key)
    {
        $file = $this->_getFileName($key);

        if (@filemtime($file) >= time()) {
            return file_get_contents($file);
        } else {
            return false;
        }
    }
256427
public function getCacheTime($key)
    {
        $file=$this->getCacheDir().$key;
        if(file_exists($file))
            return filemtime($file);
            return null;
    }
817489
protected function getFilename(string $key): string
    {
        $sub = \substr(\hash('sha256', $key), 0, 2);

        return $this->directory . '/' . $sub . '/' . \base64_encode($key) . self::EXTENSION;
    }