Determining unread items in a forum

后端 未结 7 1657
执念已碎
执念已碎 2020-12-30 17:07

Using PHP and MySQL, I have a forum system I\'m trying to build. What I want to know is, how can I set it so that when a user reads a forum entry, it shows as read JUST for

7条回答
  •  臣服心动
    2020-12-30 17:27

    Bobince has a lot of good suggestions. Another few potential optimizations:

    Write the new "is this new?" information to memcached and to a MySQL "ARCHIVE" table. A batch job can update the "real" table.

    For each user, keep a "everything read up until $date" flag (for when "mark all read" is clicked).

    When something new is posted, clear all the "it's been read" flags -- that keeps the number of "flags" down and the table can just be (topic_id, user_id) -- no timestamps.

提交回复
热议问题