public function save( string $name, $data, int $length ): bool
	{
		if ($length <= 0)
			throw new SettingsException("Expiration time has to be greater than 0.");

		$path = $this->cacheDir . DIRECTORY_SEPARATOR . $name;
		$res  = @fopen($path, 'w+');

		if ($res == false)
			throw new SettingsException("Saving - Cache file ($path) failed to be opened/created.");

		$storage = new FileCacheStorage($data, $length);
		$written = fwrite($res, serialize($storage));
		fclose($res);

		return boolval($written);
	}
public function save( string $name, $data, int $length ): bool
	{
		if ($length <= 0)
			throw new SettingsException("Expiration time has to be greater than 0.");

		$path = $this->cacheDir . DIRECTORY_SEPARATOR . $name;
		$res  = @fopen($path, 'w+');

		if ($res == false)
			throw new SettingsException("Saving - Cache file ($path) failed to be opened/created.");

		$storage = new FileCacheStorage($data, $length);
		$written = fwrite($res, serialize($storage));
		fclose($res);

		return boolval($written);
	}
public function save ( string $ name , $ data , int $ length ) : bool { if ( $ length <= 0 ) throw new SettingsException ( "Expiration time has to be greater than 0." ) ; $ path = $ this -> cacheDir . DIRECTORY_SEPARATOR . $ name ; $ res = @ fopen ( $ path , 'w+' ) ; if ( $ res == false ) throw new SettingsException ( "Saving - Cache file ($path) failed to be opened/created." ) ; $ storage = new FileCacheStorage ( $ data , $ length ) ; $ written = fwrite ( $ res , serialize ( $ storage ) ) ; fclose ( $ res ) ; return boolval ( $ written ) ; }
Saves data to file.

@param string $name
@param        $data
@param int    $length

@return bool
@throws SettingsException
Saves data to file .