starts annotation cache with given cache file

@param  string  $cacheFile  path to file wherein cached annotation data is stored
@since  3.0.0
555749
public static function startFromFileCache(string $cacheFile)
    {
        self::start(
                function() use($cacheFile)
                {
                    if (file_exists($cacheFile)) {
                        return unserialize(file_get_contents($cacheFile));
                    }

                    return [];
                },
                function(array $annotationData) use($cacheFile)
                {
                    file_put_contents($cacheFile, serialize($annotationData));
                }
        );
    }
475257
public function warmUp($cacheDir)
    {
        $baseDir = $this->annotationDir.DIRECTORY_SEPARATOR.'Sidus'.DIRECTORY_SEPARATOR.'EAV'.DIRECTORY_SEPARATOR;
        if (!@mkdir($baseDir, 0777, true) && !is_dir($baseDir)) {
            throw new \RuntimeException("Unable to create annotations directory: {$baseDir}");
        }

        foreach ($this->familyRegistry->getFamilies() as $family) {
            $content = $this->getFileHeader($family);

            foreach ($family->getAttributes() as $attribute) {
                $content .= $this->getAttributeMethods($family, $attribute);
            }

            $content .= "}\n";

            $this->writeFile($baseDir.$family->getCode().'.php', $content);
        }
    }
231796
public function loadFile()
    {
        $key = $this->getKey();

        $tags = $this->getTags();

        if (!$this->cache->has($key, $tags)) {
            $this->xmlRepo->loadFile();

            $XMLFile = $this->xmlRepo->getFile()->asXML();

            $this->cache->put($key, $XMLFile, $tags, $this->seconds);
        }
    }
569533
private static function getCacheDir($imageFile) {
    $mediaRoot = self::getMediaRootRelative();
    return self::getCacheRoot().dirname(substr($imageFile, strlen($mediaRoot))).'/';
  }
922129
protected function getTtl(string $cacheFile)
    {
        switch ($this->ttlStrategy) {
            case 'embed':
                return (int)$this->readLine($cacheFile);
            case 'file':
                return file_exists("$cacheFile.ttl")
                    ? (int)file_get_contents("$cacheFile.ttl")
                    : PHP_INT_MAX;
            case 'mtime':
                return $this->getTtl() > 0 ? filemtime($cacheFile) + $this->ttl : PHP_INT_MAX;
        }
    }
26067
protected function beforeFilter($originalFile, $cacheFile)
    {
        if ($this->isLess($originalFile)) {
            $less = new lessc();
            try {
                $compiledLess = $less->cachedCompile($originalFile);
            } catch (\Exception $e) {
                throw new CompilationException('Error in LESS Compiler', 0, $e);
            }
            $compiledLess['compiled'] = $this->fixRelativePaths($compiledLess['compiled'], $originalFile);
            file_put_contents($cacheFile, serialize($compiledLess));
        } elseif ($this->isScss($originalFile)) {
            $scss = new ScssCompiler();
            $scss->addImportPath(pathinfo($originalFile, PATHINFO_DIRNAME));
            try {
                $compiled = $scss->compile(file_get_contents($originalFile));
            } catch (\Exception $e) {
                throw new CompilationException('Error in SCSS Compiler', 0, $e);
            }

            $content = compact('compiled');
            $parsedFiles = $scss->getParsedFiles();
            $parsedFiles[] = $originalFile;
            foreach ($parsedFiles as $file) {
                $content['files'][$file] = filemtime($file);
            }

            $content['compiled'] = $this->fixRelativePaths($content['compiled'], $originalFile);
            file_put_contents($cacheFile, serialize($content));
        } else {
            $content = file_get_contents($originalFile);
            file_put_contents($cacheFile, $this->fixRelativePaths($content, $originalFile));
        }
    }
792940
void overrideCacheFile(File newCacheFile)
  {
    this.cacheFile = newCacheFile;
    this.cacheDir = newCacheFile.getParentFile();
    this.baseCacheFileName = newCacheFile.getName();
  }
766738
protected function cacheFile($path, $cachefsPath)
    {
        if (array_key_exists($path, $this->cachedFiles)) {
            return;
        }

        if (file_exists($path)) {
            $contents = file_get_contents($path);
            file_put_contents($cachefsPath, $contents);

            $this->cachedFiles[$path] = $cachefsPath;
        }
    }
738299
protected function checkCache($originalFile, $cacheFile)
    {
        if (! $return = parent::checkCache($originalFile, $cacheFile)) {
            /**
             * If using the placeholder when the original file doesn't exist
             * and it has already been cached, return the cached contents.
             * Also make sure the placeholder hasn't been modified since being cached.
             */
            $this->placeholder = $this->parsePlaceholders($originalFile);
            if (! file_exists($originalFile) && $this->placeholder) {
                return parent::checkCache($this->placeholder, $cacheFile);
            }
        }

        return $return;
    }
515143
public function setCacheFolder(?string $cacheFolder)
	{
		if (substr($cacheFolder, -1) !== '/') {
			$cacheFolder .= "/";
		}
		$this->cacheFolder = $cacheFolder;
		$this->initCache();
		return $this;
	}
1158804
public function loadFile($filename) {
		$this->filename = $filename;


		// If a cache directory was specified,
        // try to load from it
		if ($this->cachePath) {
		    if (! $this->templatesRoot) {
		        $this->templatesRoot = dirname($filename);
            }
		    $cacheFile = $this->makeCacheFilename($this->cachePath, $this->templatesRoot, $this->filename);
            if ( file_exists($cacheFile)
                 && (! file_exists($this->filename) || (filemtime($this->filename) < filemtime($cacheFile)) )
            ) {
                $this->loadFromSerialized(file_get_contents($cacheFile));
                return;
            }
        }

		if(file_exists($filename)) {
			$this->source = file_get_contents($filename);
		} else {
			$message = "File not found: $filename";
			throw new FileNotFoundException($message, $filename);
		}
	}
557393
protected function createCacheFile()
    {
        $this->createCacheDir();

        $cacheFilePath = $this->getCacheFile();

        if ( ! file_exists($cacheFilePath)) {
            touch($cacheFilePath);
        }
    }
1214772
public function setCacheDir($cacheDir) {
    $this->view->setCompileDir(WCMF_BASE.$cacheDir.'templates_c/');
    $this->view->setCacheDir(WCMF_BASE.$cacheDir.'cache/');

    $fileUtil = new FileUtil();
    $fileUtil->mkdirRec($this->view->getCompileDir());
    $fileUtil->mkdirRec($this->view->getCacheDir());
  }
1352195
protected function checkNumberOfAllowedFilters($cacheFile)
    {
        $pathInfo = pathinfo($cacheFile);
        $fileNameHash = preg_replace('%-.*$%', '', $pathInfo['filename']);
        // Grab all the similar files
        $cachedImages = glob($pathInfo['dirname'] . DS . $fileNameHash . '*');

        if (! is_array($cachedImages)) {
            $cachedImages = array();
        }

        // Loop through and remove the ones that are older than the time limit
        foreach ($cachedImages as $k => $image) {
            if (filemtime($image) < time() - $this->options['allowedFiltersTimeLimit']) {
                unset($cachedImages[$k]);
            }
        }

        // Check and see if we've reached the maximum allowed resizes within the current time limit.
        if (count($cachedImages) >= $this->options['numberOfAllowedFilters']) {
            throw new ErrorException('You cannot create anymore resizes/manipulations at this time.');
        }
    }
761027
protected function loadStatements(File $phpcsFile) {
		if ($this->existingStatements !== null) {
			return;
		}

		$existingStatements = $this->getUseStatements($phpcsFile);
		$this->existingStatements = $existingStatements;
		$this->allStatements = $existingStatements;
		$this->newStatements = [];
	}
1199859
public function cache_file_by_reference($reference, $storedfile) {
        try {
            $this->import_external_file_contents($storedfile, $this->max_cache_bytes());
        } catch (Exception $e) {
            // Cache failure should not cause a fatal error. This is only a nice-to-have feature.
        }
    }
531949
protected function beforeFilter($originalFile, $cacheFile)
    {
        if ('coffee' == pathinfo($originalFile, PATHINFO_EXTENSION)) {
            $coffeeScript = CoffeeScript\Compiler::compile(file_get_contents($originalFile), array('header' => false));
            file_put_contents($cacheFile, $coffeeScript);
        }
    }