/**
  * Inserts a new row or updates an existing one.
  * 
  * If a key already exists with some columns and you update it, any columns
  * not listed in the update statement will not be changed or deleted.
  * 
  * If not set, default consistency level set in the constructor is used.
  * 
  * You generally do not need to provide a timestamp, it is generated for
  * you.
  * 
  * You may optionally provide the time-to-live period in seconds after which
  * the entry will appear deleted.
  * 
  * @param string $key Key to set or update
  * @param array $columns Array of column names and their values
  * @param integer $consistency Consistency level to use
  * @param integer $timestamp Optional timestamp to use.
  * @param integer $timeToLiveSeconds Optional time-to-live period
  * @throws Exception If something goes wrong
  */
 public function set($key, array $columns, $consistency = null, $timestamp = null, $timeToLiveSeconds = null)
 {
     if ($timestamp === null) {
         $timestamp = CassandraUtil::getTimestamp();
     }
     if ($consistency === null) {
         $consistency = $this->defaultWriteConsistency;
     }
     $mutationMap = array($key => array($this->name => $this->createColumnMutations($columns, $timestamp, $timeToLiveSeconds)));
     $this->cassandra->call('batch_mutate', $mutationMap, $consistency);
 }
 public function testMaxCallRetriesCanBeSet()
 {
     $this->cassandra->setMaxCallRetries(3);
     $this->cassandra->setDefaultColumnCount(50);
     try {
         $this->cassandra->call('foobar');
     } catch (Exception $e) {
         $this->assertEquals($e->getMessage(), 'Failed calling "foobar" the maximum of 3 times');
     }
 }
 /**
  * Updates counter column by some amount defaulting to one.
  * 
  * @param string $key Key name
  * @param string $column Column name
  * @param integer $amount By how much to change the counter value
  * @param string $superColumn Optional supercolumn name
  * @param integer $consistency Consistency level to use
  * @author Madhan Dennis <*****@*****.**>
  */
 public function updateCounter($key, $column, $amount = 1, $superColumn = null, $consistency = null)
 {
     $columnParent = $this->createColumnParent($superColumn);
     $counter = new cassandra_CounterColumn();
     $counter->name = CassandraUtil::pack($column, $this->getColumnNameType());
     $counter->value = $amount;
     $this->cassandra->call('add', $key, $columnParent, $counter, $consistency);
 }