How to use swoole_table instead of redis as a shared cache

I took a look, first create a swoole_server, and then bind the swoole_table to it

feels more troublesome than redis

Mar.23,2021

just set up a memory table, and there is no need to create a server:

//
$userTable = new swoole_table(1024);
$userTable->column('cmd', swoole_table::TYPE_STRING, 64);
$userTable->column('userId', swoole_table::TYPE_INT, 64);
$userTable->column('room', swoole_table::TYPE_INT, 64);
$userTable->column('group', swoole_table::TYPE_INT, 4);
$userTable->column('userName', swoole_table::TYPE_STRING, 64);
$userTable->column('headImg', swoole_table::TYPE_STRING, 128);
$userTable->column('clientId', swoole_table::TYPE_INT, 4);
$userTable->column('type', swoole_table::TYPE_INT, 4);
$userTable->create();

then $userTable can be used

Menu