original_string: public function write($sql, $object)
  	{
  		$segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1);
  		$segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2);
  		$dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/';
  		$filename = md5($sql);
  
  		if ( ! is_dir($dir_path) && ! @mkdir($dir_path, 0750))
  		{
  			return FALSE;
  		}
  
  		if (write_file($dir_path.$filename, serialize($object)) === FALSE)
  		{
  			return FALSE;
  		}
  
  		chmod($dir_path.$filename, 0640);
  		return TRUE;
  	}
code: public function write($sql, $object)
  	{
  		$segment_one = ($this->CI->uri->segment(1) == FALSE) ? 'default' : $this->CI->uri->segment(1);
  		$segment_two = ($this->CI->uri->segment(2) == FALSE) ? 'index' : $this->CI->uri->segment(2);
  		$dir_path = $this->db->cachedir.$segment_one.'+'.$segment_two.'/';
  		$filename = md5($sql);
  
  		if ( ! is_dir($dir_path) && ! @mkdir($dir_path, 0750))
  		{
  			return FALSE;
  		}
  
  		if (write_file($dir_path.$filename, serialize($object)) === FALSE)
  		{
  			return FALSE;
  		}
  
  		chmod($dir_path.$filename, 0640);
  		return TRUE;
  	}
code_tokens: public function write ( $ sql , $ object ) { $ segment_one = ( $ this -> CI -> uri -> segment ( 1 ) == FALSE ) ? 'default' : $ this -> CI -> uri -> segment ( 1 ) ; $ segment_two = ( $ this -> CI -> uri -> segment ( 2 ) == FALSE ) ? 'index' : $ this -> CI -> uri -> segment ( 2 ) ; $ dir_path = $ this -> db -> cachedir . $ segment_one . '+' . $ segment_two . '/' ; $ filename = md5 ( $ sql ) ; if ( ! is_dir ( $ dir_path ) && ! @ mkdir ( $ dir_path , 0750 ) ) { return FALSE ; } if ( write_file ( $ dir_path . $ filename , serialize ( $ object ) ) === FALSE ) { return FALSE ; } chmod ( $ dir_path . $ filename , 0640 ) ; return TRUE ; }
docstring: Write a query to a cache file
  
  @param	string	$sql
  @param	object	$object
  @return	bool
docstring_tokens: Write a query to a cache file