dongle19863 2011-04-11 20:40
浏览 15
已采纳

排队更新请求更新?

I have a site, and when the user does an action I wish to add that to a count of how many actions the person has ever done. Naturally I'd say "update the user table each time!" but I don't feel as if that's a good solution, and I'm interested in seeing if there is a way to do this.

Basically the user would log in and start using actions, and every time they make an action I would do [whatever] and then at the end of the day, I take all [whatever]s and make the query, saving resources on each action. Were the site to grow to 1,000 users, those little queries would start adding up! There is only one type of "action", for the sake of this question just assume each page load would be an action.

  • 写回答

2条回答 默认 最新

  • dongtuoleng8624 2011-04-11 20:55
    关注

    if its a single session, store (queue) "all the updates" in a session / global variable. Update at the end of the session.

    if its a multiple-session system, I would suggest doing the above and update the table at the end of each session.

    :(upwards of few hundred kbs, this is not a good idea):

    You would want to make a shortcode endcoing /decoding library to store it into the sessions vars. If we are talking about huge data. For example, if you have a drag and drop system, the intermediate states could be key<>val pair structures. eg: LOC_A=WIDGET_1 ; LOC_B=WIDGET_88 .. so on and so forth..

    is this making sense?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器