dqqyp90576 2012-03-19 14:02
浏览 35

PHP中的基本通知系统

I have a small scale PHP social network, running with a MySQL database. Users on the network can join various groups and receive updates.

I want to notify the user when a new update has been released by a group.

I don't want to do anything fancy with sockets, I'd just like a display of how many updates have been posted since the user was last active.

I'd thought of recording the current time against a user every time they refresh the page, this way I can compare the date of updates vs. the last time a user was active.

I'm not sure that writing to the database on every page load is a good idea though. Any other suitable suggestions?

  • 写回答

2条回答 默认 最新

  • duancaiyi7567 2012-03-19 14:15
    关注

    I think the best way to do this is indeed writing to the database. However, in terms of performance there are a few ways to make it faster. Two ways I can think of are caching the updates for popular groups and creating a table which will only have users and timestamps, both indexed, so that should work very quickly.

    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题