drqxfmfa804578 2012-02-07 20:24
浏览 54
已采纳

需要帮助将数据写入多客户端Web应用程序中的文件?

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.

  • 写回答

1条回答 默认 最新

  • dongshou6788 2012-02-07 20:41
    关注

    I would definitely write the data into a MySQL table and retrieve it only when needed. Some advantages:

    • file locking problems you mentioned already
    • scalability
    • easier to filter (maybe at some point not all clients want all data)
    • easier to extend the schema with new attributes
    • ...
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 在获取boss直聘的聊天的时候只能获取到前40条聊天数据
  • ¥20 关于URL获取的参数,无法执行二选一查询
  • ¥15 液位控制,当液位超过高限时常开触点59闭合,直到液位低于低限时,断开
  • ¥15 marlin编译错误,如何解决?
  • ¥15 有偿四位数,节约算法和扫描算法
  • ¥15 VUE项目怎么运行,系统打不开
  • ¥50 pointpillars等目标检测算法怎么融合注意力机制
  • ¥20 Vs code Mac系统 PHP Debug调试环境配置
  • ¥60 大一项目课,微信小程序
  • ¥15 求视频摘要youtube和ovp数据集