//swoole直接操作系统的内存 单线程每秒可执行三百万次 主要用于进程间的数据通信 $swoole_table = new swoole_table(1024);//1024为内创建内存对象所能存储的最大行数 //创建内存表的字段 $swoole_table->column('id', $swoole_table::TYPE_INT, 4 ); $swoole_table->column('name', $swoole_table::TYPE_STRING, 64 ); $swoole_table->column('age', $swoole_table::TYPE_INT, 3); $swoole_table->create(); //内存表内添加一列 //第一个参数为key,第二个参数value $swoole_table->set('zonehoo',['id' =>'1','name'=>'zonehoo','age'=>'18']); //写成数组的形式 $swoole_table['zonehoo_2'] = [ 'id' => 2, 'name' => 'zonehoo2', 'age' => 19, ]; //获取 print_r($swoole_table->get('zonehoo')); // print_r($swoole_table->get('zonehoo_2')); print_r($swoole_table['zonehoo_2']); //表内某一值增加 $swoole_table->incr('zonehoo_2','age','2'); print_r($swoole_table['zonehoo_2']); //表内某一值减 $swoole_table->decr('zonehoo_2','age','1'); print_r($swoole_table['zonehoo_2']);