需要帮助将数据写入多客户端 Web 应用程序中的文件吗?
将数据写入每天通过提要链接获取的文件的最佳方法是什么?
我希望我们的多客户端 Web 应用程序允许每个客户端在单击“发布到源”按钮时将信息写入 .xml 文件。然后,检索该 xml 文件的提要每天都会获取该文件。但是,客户可以在一天中的任何时间单击按钮来发布应放入 xml 文件中的信息。
我最初的想法是只使用php的fopen、fwrite直接写入文件。但是,随着客户端的增长,我希望避免主 .xml 文件在更新期间被锁定的可能性,这将阻止其他用户向 xml 文件添加数据。
文件是否有可能像这样被锁定,还是我担心一些无关紧要的事情?我们将有大约 3000 名客户。
我是否最好将他们的信息放入 mysql 表中,然后编写一个每小时运行一次的单独进程来查询数据库并将任何新帖子写入 xml 文件中,这会限制文件被锁定的可能性?
你会给我什么建议?
提前致谢。
Whats the best approach for writing data to a file that will be picked up daily by a link to the feed?
I want our multi-client web app to allow each client to write information into an .xml file when they click a "post to feeds" button. That xml file will then be picked up daily by the feed that retrieves it. However, at any time of the day the clients can click a button to post information that should be put inside the xml file.
My initial thoughts were to just use php's fopen, fwrite to write directly to the file. However, as clients grow I want to avoid the possibility of the main .xml file getting locked during an update, which would prevent other users from being able to add data to the xml file.
Is the file getting locked like this even possible, or am I worrying about something insignificant? We'll have about 3000 clients.
Would I be better off putting their information into the mysql table, then write a separate process that runs once an hour to query the database and write any new posts into the xml file, which would limit the possibitily of the file getting locked?
What advice would you give me?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我肯定会将数据写入 MySQL 表并仅在需要时检索它。
一些优点:
I would definitely write the data into a
MySQL
table and retrieve it only when needed.Some advantages: