get_client() public static method

Default client
public static get_client ( $write_mode = false )
Esempio n. 1
0
 public function remove($key, $column_name = null)
 {
     $timestamp = time();
     $column_path = new cassandra_ColumnPath();
     $column_path->column_family = $this->column_family;
     if ($this->is_super) {
         $column_path->super_column = $this->unparse_column_name($column_name, true);
     } else {
         $column_path->column = $this->unparse_column_name($column_name, false);
     }
     $client = CassandraConn::get_client();
     $resp = $client->remove($this->keyspace, $key, $column_path, $timestamp, $this->write_consistency_level);
     return $resp;
 }
Esempio n. 2
0
 /**
  * 清除指定colnames
  * @param $key
  * @param $super
  * @param $colnames
  * @return
  */
 public function erase($key, $colnames, $sc_name = null)
 {
     $mu = new cassandra_Mutation();
     $del = new cassandra_Deletion();
     $slice = new cassandra_SlicePredicate();
     $slice->column_names = array('name', 'time');
     $del->predicate = $slice;
     $del->super_column = $this->unparse_column_name($sc_name, $this->column_type);
     $del->timestamp = CassandraUtil::get_time();
     $mu->deletion = $del;
     $mus[] = $mu;
     $client = CassandraConn::get_client();
     $mmap = array();
     $mmap[$key][$this->column_family] = $mus;
     $client->batch_mutate($this->keyspace, $mmap, $this->write_consistency_level);
 }