Returns cache if exists, otherwise the translation cache file is created, filled with content and returned
@param sFire\System\File $cache
@param sFire\System\File $file
3212
private static function cache(File $cache, File $file) {

		if(false === isset(static :: $translations[$cache -> entity() -> getName()])) {

			$parse = true;

			if(true === $cache -> exists()) {
				
				if($cache -> entity() -> getModificationTime() >= $file -> entity() -> getModificationTime()) {
					$parse = false;
				}
			}

			//Check if file needs to be parsed
			if(true === $parse) {

				$content = serialize(static :: parse($file));
				$cache -> create() -> flush() -> append($content);
			}

			static :: $translations[$cache -> entity() -> getName()] = unserialize($cache -> getContent());
		}
	}
1218279
private function cache(string $file, string $name)
	{
		$cache = str_replace($this->DS, '___', $name) . '@' . str_replace($this->DS, '___', $file);

		$compiled = $this->response(file_get_contents($file));

		file_put_contents($this->cacheDirectory . $this->DS . $cache, $compiled);
	}
299695
public static function loadKeyFromCertificateFile($file)
    {
        Assertion::true(file_exists($file), sprintf('File "%s" does not exist.', $file));
        $content = file_get_contents($file);

        return self::loadKeyFromCertificate($content);
    }
939299
protected function read($file)
    {
        $data = null;
        $key  = $file;
        $file = $this->getFileName($file);

        if ( file_exists($file))
        {
            // if cache file not expire
            if (filemtime($file) >= time())
            {
                echo "read cache<br/>";
                $data = file_get_contents($file);
                $data = ($this->base64Encode) ? base64_decode($data) : $data;
                $data = unserialize($data);
                static::$keys[$key] = true;
            }
            else
            {
                unset(static::$keys[$key]);
                unlink($file);
            }
        }

        return $data;
    }
265302
public function file_cache($key,$value=null,$expire=70,$prefix=''){
        if (empty($key)) return false;
        $option = array(
            'type'=>'File',
            'prefix'=>$prefix,
            'path'=>CACHE_PATH,
        );
        $expire = empty($expire)?0:$expire;
        $cache = \think\Cache::connect($option);
        if ($value){
            return $cache->set($key,$value,$expire);
        }else{
            return $cache->rm($key);
        }
    }
922065
public function write(File $file)
    {
        $success = file_put_contents(
            $this->getRouteCachePath($file->getRoute()),
            $file->toString()
        );
        if ($success === false) {
            throw new CacheFileSystemException(
                "Unable to save Cache file to disk in file " . $this->getRouteCachePath($file->getRoute())
            );
        }
    }
534966
protected function _loadCache($cache_file)
    {
        require $cache_file;
        
        if (!isset($cache_version) || $cache_version != self::CACHE_FILE_VERSION)
        {
          return false;
        }
        
        $this->_source_version = $source_version;
        $this->_browsers = $browsers;
        $this->_userAgents = $userAgents;
        $this->_patterns = $patterns;
        $this->_properties = $properties;

        $this->_cacheLoaded = true;
        
        return true;
    }
23244
protected function readFromCache($fileName)
    {
        $cacheFile = $this->getCacheFile($fileName);
        if (file_exists($cacheFile) && is_readable($cacheFile)) {
            include($cacheFile);
            if (isset($crudlexCacheContent)) {
                return $crudlexCacheContent;
            }
        }
        return null;
    }
1143161
public function getCache() : FileCache
    {
        if (!$this->cache) {
            $this->cache = Yii::createObject([
                'class'     => FileCache::className(),
                'cachePath' => Yii::getAlias($this->cachePath)
            ]);
        }
        return $this->cache;
    }
733030
public function setCache($file)
	{
		if ( ! empty($file)) {
			$this->cache = new AccessTokenCache($file);

			$this->setAccessToken($this->cache->get());
		}
	}
212765
public function getLanguage($file = '')
    {
        $path = $this->path . DIRECTORY_SEPARATOR . $file . '.php';
        if (file_exists($path)) {
            $variables = require $path;
            return $variables;
        } else {
            return false;
        }
    }
319097
static public function contentViewRetrieve( $file, $mtime, $args )
    {
        extract( $args );

        $cacheExpired = false;

        // Read Cache file
        if ( !eZContentObject::isCacheExpired( $mtime ) )
        {
//        $contents = $cacheFile->fetchContents();
            $contents = file_get_contents( $file );
            $Result = unserialize( $contents );

            if( !is_array( $Result ) )
            {
                $expiryReason = 'Unexpected cache file content';
                $cacheExpired = true;
            }

            // Check if a no_cache key has been set in the viewcache, and
            // return an eZClusterFileFailure if it has
            if ( isset( $Result['no_cache'] ) )
            {
                return new eZClusterFileFailure( 3, "Cache has been disabled for this node" );
            }

            // Check if cache has expired when cache_ttl is set
            $cacheTTL = isset( $Result['cache_ttl'] ) ? $Result['cache_ttl'] : -1;
            if ( $cacheTTL > 0 )
            {
                $expiryTime = $mtime + $cacheTTL;
                if ( time() > $expiryTime )
                {
                    $cacheExpired = true;
                    $expiryReason = 'Content cache is expired by cache_ttl=' . $cacheTTL;
                }
            }

            // Check if template source files are newer, but only if the cache is not expired
            if ( !$cacheExpired )
            {
                $developmentModeEnabled = $ini->variable( 'TemplateSettings', 'DevelopmentMode' ) == 'enabled';
                // Only do filemtime checking when development mode is enabled.
                if ( $developmentModeEnabled &&
                     isset( $Result['template_list'] ) ) // And only if there is a list stored in the cache
                {
                    foreach ( $Result['template_list'] as $templateFile )
                    {
                        if ( !file_exists( $templateFile ) )
                        {
                            $cacheExpired = true;
                            $expiryReason = "Content cache is expired by template file '" . $templateFile . "', it does not exist anymore";
                            break;
                        }
                        else if ( filemtime( $templateFile ) > $mtime )
                        {
                            $cacheExpired = true;
                            $expiryReason = "Content cache is expired by template file '" . $templateFile . "'";
                            break;
                        }
                    }
                }
            }

            if ( !$cacheExpired )
            {
                if ( !isset( $Result['content_info'] ) )
                {
                    // set error type & number for kernel errors (see https://jira.ez.no/browse/EZP-23046)
                    if ( isset( $Result['errorType'] ) && isset( $Result['errorNumber'] ) )
                    {
                        $res = eZTemplateDesignResource::instance();
                        $res->setKeys(
                            array(
                                array( 'error_type', $Result['errorType'] ),
                                array( 'error_number', $Result['errorNumber'] )
                            )
                        );
                    }
                    return $Result;
                }
                $keyArray = array( array( 'object', $Result['content_info']['object_id'] ),
                                   array( 'node', $Result['content_info']['node_id'] ),
                                   array( 'parent_node', $Result['content_info']['parent_node_id'] ),
                                   array( 'parent_node_remote_id', $Result['content_info']['parent_node_remote_id'] ),
                                   array( 'parent_object_remote_id', $Result['content_info']['parent_object_remote_id'] ),
                                   array( 'class', $Result['content_info']['class_id'] ),
                                   array( 'view_offset', $Result['content_info']['offset'] ),
                                   array( 'navigation_part_identifier', $Result['content_info']['navigation_part_identifier'] ),
                                   array( 'viewmode', $Result['content_info']['viewmode'] ),
                                   array( 'depth', $Result['content_info']['node_depth'] ),
                                   array( 'remote_id', $Result['content_info']['remote_id'] ),
                                   array( 'node_remote_id', $Result['content_info']['node_remote_id'] ),
                                   array( 'url_alias', $Result['content_info']['url_alias'] ),
                                   array( 'persistent_variable', $Result['content_info']['persistent_variable'] ),
                                   array( 'class_group', $Result['content_info']['class_group'] ),
                                   array( 'parent_class_id', $Result['content_info']['parent_class_id'] ),
                                   array( 'parent_class_identifier', $Result['content_info']['parent_class_identifier'] ),
                                   array( 'state', $Result['content_info']['state'] ),
                                   array( 'state_identifier', $Result['content_info']['state_identifier'] ),
                                   array( 'section', $Result['section_id'] ) );

                if ( isset( $Result['content_info']['class_identifier'] ) )
                    $keyArray[] = array( 'class_identifier', $Result['content_info']['class_identifier'] );

                // Added in 5.3.5 / 5.4.2, so test that cache contains this before using
                if ( isset( $Result['content_info']['section_identifier'] ) )
                    $keyArray[] = array( 'section_identifier', $Result['content_info']['section_identifier'] );

                $res = eZTemplateDesignResource::instance();
                $res->setKeys( $keyArray );

                return $Result;
            }
        }
        else
        {
            $expiryReason = 'Content cache is expired by eZContentObject::isCacheExpired(' . $mtime . ")";
        }

        // Cache is expired so return specialized cluster object
        if ( !isset( $expiryReason ) )
            $expiryReason = 'Content cache is expired';
        return new eZClusterFileFailure( 1, $expiryReason );
    }
140067
protected function createCacheFile($key, $content) {
        // Gera o nome do arquivo
        $filename = $this->generateFileLocation($key);

        // Cria o arquivo com o conteúdo
        return file_put_contents($filename, $content)
        OR trigger_error('Não foi possível criar o arquivo de cache', E_USER_ERROR);
    }
727688
protected function getCacheHash($file)
	{
		$fs_class = explode('\\', get_class($this->fs));
		return $this->f3->hash($this->f3->stringify($file)).
			'.'.strtolower(array_pop($fs_class)).'.meta';
	}
277783
public function getCachedFile($cacheKey) {

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

        if (file_exists($directory . "/" . $filename) && !is_dir($directory . "/" . $filename)) {
            return file_get_contents($directory . "/" . $filename);
        }

        return null;


    }
1129898
public function loadExistingFileContentsFromCache($file_path)
    {
        $root_cache_directory = Config::getInstance()->getCacheDirectory();

        if (!$root_cache_directory) {
            return;
        }

        $file_cache_key = $this->getParserCacheKey(
            $file_path
        );

        $parser_cache_directory = $root_cache_directory . DIRECTORY_SEPARATOR . self::FILE_CONTENTS_CACHE_DIRECTORY;

        $cache_location = $parser_cache_directory . DIRECTORY_SEPARATOR . $file_cache_key;

        if (is_readable($cache_location)) {
            return file_get_contents($cache_location);
        }
    }
266056
private function getFileContents($file)
    {
        if (!isset($this->filesContent[$file])) {
            $this->filesContent[$file] = file_exists($file) ? file($file) : [];
        }

        return $this->filesContent[$file];
    }