src/Brainly.php
private function writeCache($data)
	{
		$this->cacheMap[$this->hash] = time();
		$handle = fopen($this->cacheMapFile, "w");
		flock($handle, LOCK_EX);
		$write1 = fwrite($handle, 
			json_encode(
				$this->cacheMap, 
				JSON_UNESCAPED_SLASHES
			)
		);
		fclose($handle);
		$handle = fopen($this->cacheFile, "w");
		flock($handle, LOCK_EX);
		$write2 = fwrite($handle, $data);
		fclose($handle);
		return (
			(bool) $write1 && (bool) $write2
		);
	}
private function writeCache($data)
	{
		$this->cacheMap[$this->hash] = time();
		$handle = fopen($this->cacheMapFile, "w");
		flock($handle, LOCK_EX);
		$write1 = fwrite($handle, 
			json_encode(
				$this->cacheMap, 
				JSON_UNESCAPED_SLASHES
			)
		);
		fclose($handle);
		$handle = fopen($this->cacheFile, "w");
		flock($handle, LOCK_EX);
		$write2 = fwrite($handle, $data);
		fclose($handle);
		return (
			(bool) $write1 && (bool) $write2
		);
	}
private function writeCache ( $ data ) { $ this -> cacheMap [ $ this -> hash ] = time ( ) ; $ handle = fopen ( $ this -> cacheMapFile , "w" ) ; flock ( $ handle , LOCK_EX ) ; $ write1 = fwrite ( $ handle , json_encode ( $ this -> cacheMap , JSON_UNESCAPED_SLASHES ) ) ; fclose ( $ handle ) ; $ handle = fopen ( $ this -> cacheFile , "w" ) ; flock ( $ handle , LOCK_EX ) ; $ write2 = fwrite ( $ handle , $ data ) ; fclose ( $ handle ) ; return ( ( bool ) $ write1 && ( bool ) $ write2 ) ; }
Write cache.

@param string $data
@return bool
Write cache .