简体   繁体   English

Heroku-如何保存状态

[英]Heroku - how to save state

I noticed that if there's no activity on the server for a while it shuts down and starts again when there's new activity, thus any previous states are gone. 我注意到,如果在一段时间内服务器上没有任何活动,则它会关闭并在有新活动时再次开始,因此以前的所有状态都消失了。

For example, I have a list of connected users with the username they entered, and the list is emptied if there's no activity for a while. 例如,我有一个已连接用户及其用户名输入的列表,如果有一段时间没有任何活动,该列表将被清空。

What is the recommended way to save states on Heroku? 在Heroku上保存状态的推荐方法是什么?

Would serializing the state to a file every few minutes work? 每隔几分钟就可以将状态序列化为文件吗? Do I even have write access on Heroku? 我什至对Heroku拥有写访问权限吗?

您的HTTP服务器应该是无状态的-任何重要的信息都应该存储在其他地方,例如数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM