Store the cache path and check if the file cache can enabled or not
@param string $pathCacheFile
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;
        }
    }
954689
public function setCachePath($path)
    {
        if (@file_exists($path) && is_dir($path)) {
            $this->cache_path = realpath($path).'/';
        } elseif (null!==$path_rp = $this->findRealPath($path)) {
            $this->cache_path = rtrim($path_rp, '/').'/';
        } else {
            throw new \InvalidArgumentException(
                sprintf('Cache path "%s" was not found or is not a directory!', $path)
            );
        }
        return $this;
    }
1128311
private function saveCacheFile($path, $data)
	{
		if (!is_writable($this->dir)) {
		    throw new \InvalidArgumentException(sprintf('The directory "%s" is not writable. Both, the webserver and the console user need access. You can manage access rights for multiple users with "chmod +a". If your system does not support this, check out the acl package.', $this->dir));
		}

		$tempfile = tempnam($this->dir, uniqid('', true));

		if (false === $tempfile) {
		    throw new \RuntimeException(sprintf('Unable to create tempfile in directory: %s', $this->dir));
		}

		$written = file_put_contents($tempfile, '<?php return unserialize('.var_export(serialize($data), true).');');

		if (false === $written) {
		    throw new \RuntimeException(sprintf('Unable to write cached file to: %s', $tempfile));
		}

		@chmod($tempfile, 0666 & (~$this->umask));

		if (false === rename($tempfile, $path)) {
		    @unlink($tempfile);
		    throw new \RuntimeException(sprintf('Unable to rename %s to %s', $tempfile, $path));
		}
	}
400056
public function isExpired($path)
    {
        $cachePath = $this->getCacheFile($this->getCacheKey($path));

        if (!is_file($cachePath)) {
            return true;
        }

        return filemtime($path) >= filemtime($cachePath);
    }
1054476
function is_cached( $path, $method = 'GET', $params = array() ) {
			$cache_key = $this->get_cache_key( $path, $method, $params );

			return self::$_cache->has_valid( $cache_key );
		}
1198875
public function storeCache(array $cache)
    {
        if ($this->store === null) {
            register_shutdown_function([$this, 'saveCacheFile']);
        }

        $this->store = $cache;
    }
549221
private function cacheMap($cacheFilePath, $map)
    {
        if (!file_exists(dirname($cacheFilePath))) {
            mkdir(dirname($cacheFilePath), 0777, true);
        }
        return FileWriter::writeObject($cacheFilePath, $map, true);
    }
1126895
private function saveContainerToCache($cachefile)
    {
        $dumper = new PhpDumper($this->symfonyContainer);
        file_put_contents($cachefile, $dumper->dump());
    }
1197177
private function ensureSymlink($pathFile)
    {
        if (false === $this->symlinker->hasSymlink($pathFile)) {
            $this->symlinker->symlink($pathFile);
        }
    }
903658
public function isCached($cacheKey)
    {
        // TODO: Refactor for strict types!
        $path = $this->resolvePath($cacheKey, false);
        if (file_exists($path)) {
            return $path;
        } else {
            return false;
        }
    }
412009
public function setCachePath($path = null)
    {
        if (is_null($path)) {
            $this->path = __DIR__;
        } else {
            $this->path = filter_var($path, FILTER_SANITIZE_STRING);
        }
    }
745882
protected function checkCache($originalFile, $cacheFile)
    {
        if (! $ret = parent::checkCache($originalFile, $cacheFile)) {
            return false;
        }

        if (Utils::isSerialized($ret, $ret)) {
            // Go through each file and make sure none of them have changed
            foreach ($ret['files'] as $file => $lastModified) {
                if (filemtime($file) > $lastModified) {
                    return false;
                }
            }

            $ret = serialize($ret);
        }

        return $ret;
    }
1100137
private function isCacheUpToDate($cachedFile, $templateFile)
    {
        if (!file_exists($cachedFile)) {
            return false;
        }

        $cacheTime = filemtime($cachedFile);
        $templTime = filemtime($templateFile);

        return $cacheTime == $templTime;
    }
973751
def cache(cache_directory_path):
    """"""
    if not cache_directory_path:
        click.secho(dtool_config.utils.get_cache(
            CONFIG_PATH,
        ))
    else:
        click.secho(dtool_config.utils.set_cache(
            CONFIG_PATH,
            cache_directory_path
        ))
612164
private static void deleteCacheFile(final File cacheFile) {
		try {
			if (cacheFile.delete()) {
				LOG.warn(String.format(MSG_CACHE_FILE_IS_DAMAGED_AND_DELETED, cacheFile.getPath()));
			} else {
				LOG.warn(String.format(MSG_CACHE_FILE_IS_DAMAGED, cacheFile.getPath()));
			}
		} catch (final Exception e) {
			LOG.warn(String.format(MSG_CACHE_FILE_IS_DAMAGED, cacheFile.getPath()));
		}
	}
151968
protected function setupFile($originalFile, $cacheFile)
    {
        // Check if the file exists
        if (! file_exists($originalFile)) {
            throw new NotFoundException('File does not exist: ' . str_replace($this->request->webroot, '', $originalFile));
        }

        // Copy the original file to the cache location
        copy($originalFile, $cacheFile);
    }
1343198
private function saveToCache($path, $value)
    {
        if ($this->getCache()) {
            $this->getCache()->save(self::CACHE_KEY . md5($path), $value, null, [
                '_wf',
                '_component',
                '_router'
            ]);
        }
    }