swoole 的table如何释放内存?

swoole 的table如何释放内存


慕婉清6462132
浏览 1157回答 2
2回答

慕码人2483693

class msgServer{private $serv;function __construct(){$this->serv = new Swoole\Server("127.0.0.1", 9501);//创建一个服务$this->serv->set(array('task_worker_num' => 4)); //配置task进程的数量$this->serv->on('receive', array($this, 'onReceive'));//有数据进来的时候执行$this->serv->on('task', array($this, 'onTask'));//有任务的时候执行$this->serv->on('finish', array($this, 'onFinish'));//任务结束时执行$this->serv->start();}public function onReceive($serv, $fd, $from_id, $data){$data = json_decode($data, true);$task_id = $serv->task($data);//这里发起了任务,于是上面的on('task', array($this, 'onTask'))就会执行}public function onTask($serv, $task_id, $from_id, $data){$data['send_res'] = $this->sendMsg($data); //发送短信//1.7.3之前,是$serv->finish("result");return "result.";//这里告诉任务结束,于是上面的on('finish', array($this, 'onFinish'))就会执行}public function onFinish($serv, $task_id, $data){$this->addSendLog($data); //添加短信发送记录}}

肥皂起泡泡

通过php -m或phpinfo()来查看是否成功加载了swoolephp --ri swoolephp --info
打开App,查看更多内容
随时随地看视频慕课网APP