swoole websocket服务器关闭时swoole表会自行销毁吗
我正在 CentOS 7 主机上为我的聊天应用程序设置 Swoole Web 套接字服务器。并将使用 Swoole 表来存储用户列表。
但我不确定 Swoole 表的寿命是多少。当Swoole Server意外关闭时,之前创建的表会发生什么情况?我需要自己销毁它来释放内存吗?如果是,我如何找到该表并将其删除?
swoole table 的官方文档并没有提供太多细节,所以希望有经验的人能给我一个简短的解释。
i am setting up a Swoole web socket server for my chat application on CentOS 7 host machine. and will use Swoole table for storing users list.
But i am not sure what is the lifespan like for Swoole table. when the Swoole Server shuts down by accident, what will happen to the table created before? Do i need to destroy it myself to free up memory? if yes, how can i find the table and remove it?
the official document of swoole table doesn't really provide much details on it, so hopefully someone has an experience can give me a short explanation on it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
单独关闭服务器并不会清除内存,必须手动清除。
但如果整个程序崩溃,您将不需要清除内存。
Swoole 表没有生命周期,它们就像常规数组,您定义数据,然后删除它。
我认为你应该使用静态 getter,以便它在全局范围内可用,请考虑以下代码作为示例。
Shutting down of the server alone will not clear up the memory, you have to clear it up manually.
But you won't be needing to clear the memory if the entirety of the program crashed.
Swoole tables doesn't have lifespan, they're like regular arrays, you define your data, you delete it.
I think you should use static getter, so that it will be available globally, consider below code as a sample.