English 中文(简体)
phpcassa cassandra batchbyon
原标题:phpcassa cassandra batch mutation

您能否举出一个实例,说明在营地中有多少批量。

Cant understand how to work with this function and didnt found any enough information.

我还想知道如何用反制加以利用。

提前感谢。

最佳回答

“多关键数据”:

function batch_remove($key=null, $columns=null, $super_column=null, $write_consistency_level=null) {

    $timestamp = CassandraUtil::get_time();
    $deletion = new cassandra_Deletion();
    $deletion->timestamp = $timestamp;

    if ($super_column !== null) $deletion->super_column = $this->pack_name($super_column, true);
    else $deletion->super_column = null;

    if ($columns !== null) {
        $predicate = $this->create_slice_predicate($columns,   ,   , false, self::DEFAULT_COLUMN_COUNT);
        $deletion->predicate = $predicate;
    }

    $mutation = new cassandra_Mutation();
    $mutation->deletion = $deletion;

    if (is_array($key) && count($key) >= 1) {

        $mut_map = array();
        foreach($key as $v) {
            $packed_key[$v] = $this->pack_key($v);
            $mut_map[$v] = array($this->column_family => array($mutation));
        }

        return $this->pool->call("batch_mutate", $mut_map, $this->wcl($write_consistency_level));

    } else return false;

}

//delete name1, name2, name3 from key1, key2 in a single call
$column_family->batch_remove(array(key1, key2), array(name1, name2, name3));
问题回答
  1. batch_mutate on counters is not available yet with PHPCassa: https://github.com/thobbs/phpcassa/issues/31
  2. batch_mutate in action, as per the tutorial: http://thobbs.github.com/phpcassa/tutorial.html

“数据”:

 $row1 = array( name1  =>  val1 ,  name2  =>  val2 );
 $row2 = array( foo  =>  bar );
 $column_family->batch_insert(array( row1  => $row1,  row2  => $row2);




相关问题
How does Voldemort compare to Cassandra?

How does Voldemort compare to Cassandra? I m not talking about size of community and only want to hear from people who have actually used both. Especially I m interested in: How they dynamically ...

How does Cassandra rebalance when nodes go down?

Does anyone have experience with Cassandra when nodes go down or are unavailable? I am mostly interested in whether the cluster rebalances and what happens when the nodes come online, or are replaced ...

Cassandra time series data

We are looking at using Cassandra to store a stream of information coming from various sources. One issue we are facing is the best way to query between two dates. For example we will need to ...

Picking a database technology

We re setting out to build an online platform (API, Servers, Data, Wahoo!). For context, imagine that we need to build something like twitter, but with the comments (tweets) organized around a live ...

Row count of a column family in Cassandra

Is there a way to get a row count (key count) of a single column family in Cassandra? get_count can only be used to get the column count. For instance, if I have a column family containing users and ...

Update an existing column value

What happens when a new value for an existing column is added? Will the older value be overwritten by the new value? Or the older value will also retain and can be retrieved (similar to simpleDB)?

Cassandra Vs Amazon SimpleDB

I m working on an application where data size and SQL queries are going to be heavy. I am thinking between Cassandra or Amazon SimpleDB. Can you please suggest which is more suitable in this kind of ...

Cassandra load balancing with an ordered partitioner?

So I see here that Cassandra does not have automatic load balancing, which comes into view when using the ordered partitioner (a certain common range of values of a group of rows would be stored on a ...

热门标签