swoole of memory

First, the code

<? PHP
 // can be used to share data 
// performed automatically after the release 

// Create a memory table 
$ Table = new new swoole_table (1024 ); 

// memory table increase in a 
$ Table -> column ( 'ID', $ Table : : TYPE_INT,. 4 );
 $ Table -> column ( 'name', $ Table :: TYPE_STRING, 64 );
 $ Table -> column ( 'Age', $ Table :: TYPE_INT,. 3 );
 $ Table -> Create ( ); 

// setting data 
$ Table -> sET ( 'tomInfo', [ 'ID' =>. 1, 'name' => 'Tom', 'Age' => 20 is ]);
 $ Table [ 'jerryInfo'] = [
    'id'=>2,
    'name'=>'jerry',
    'age'=>20
];
$table->incr('jerryInfo', 'age', 2);
$table->decr('jerryInfo', 'age', 4);

// 获取数据
print_r($table->get('jerryInfo'));
print_r($table['jerryInfo']);

// 删除数据
$table->del('tomInfo');
print_r($table->get('tomInfo'));

 

Guess you like

Origin www.cnblogs.com/cshaptx4869/p/11140970.html