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

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1c1b227-33240.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1c1b227-33240.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?