Beispiel #1
0
 public function put($p)
 {
     $ret['s'] = 'OK';
     $t = new CassandraCF('mall', 'UserItem', true);
     // if(is_array($p)){
     $id = $p['u'];
     $ret['id'] = $t->put_super($p['d'], $id);
     return $ret;
 }
Beispiel #2
0
 public static function testSuper()
 {
     $key = time();
     $t = new CassandraCF('mall', 'UserFriend', true, CassandraCF::CT_TimeUUIDType, CassandraCF::CT_BytesType);
     $cdata = array('name' => 'user1', 'time' => time(), 'arr' => array('dfd', 'dfds'));
     echo "before insert \n";
     print_r($cdata);
     $scname = $t->put_super($cdata, $key);
     $retdata = $t->get($key, $scname);
     echo "after insert get\n";
     print_r($retdata);
     $udata['name'] = 'user12 modify';
     $udata['newcol'] = 'neww colvalue';
     $udata['id'] = $scname;
     $scname = $t->put_super($udata, $key);
     $retdata = $t->get($key, $scname);
     echo "after update get\n";
     print_r($retdata);
     echo '$t->get_count($key) = ' . $t->get_count($key) . "\n";
     $udata = array();
     $udata['name'] = 'user13 modify';
     $udata['newcol'] = 'neww colvalue';
     //$udata['id'] = $scname;
     echo "insert a new super col\n";
     $scname1 = $t->put_super($udata, $key);
     echo '$t->get_count($key) = ' . $t->get_count($key) . "\n";
     echo '$t->get_count($key,$scname) = ' . $t->get_count($key, $scname) . "\n";
     $t->erase($key, array('name', 'time'), $scname);
     $retdata = $t->get($key, $scname);
     echo "after delete cols  get\n";
     print_r($retdata);
     echo '$t->get_count($key,$scname) = ' . $t->get_count($key, $scname) . "\n";
     echo '$t->get_count($key) = ' . $t->get_count($key) . "\n";
     $udata['name'] = 'user13 modify';
     $udata['newcol'] = 'neww colvalue';
     //$udata['id'] = $scname;
     echo "after delete a new super col\n";
     $t->remove($key, $scname1);
     echo '$t->get_count($key) = ' . $t->get_count($key) . "\n";
 }