What's the most efficient way to remember read/unread status across multiple items?

感情迁移 提交于 2019-12-06 10:43:40
  1. Drop a record in the database for each user-thread combination
  2. Or store this information in a file - one file per user. It may need to be locked/unlocked in case multiple logins by the same user are allowed.

Using a database record sounds like the most promising to me. It will generate a table with millions of rows very quickly if you have an active forum but it would be the simplest solution to implement. It will give a lot of flexibility for querying which users are reading what too.

I think I saw somewhere, maybe phpbb forum? anyway

there was a table in it with userid, threadid, last-read-datetime (let name it userAsRead)

then it would compare the last post made in that threadid vs last-read-datetime

for the mark as all read, it was a field in the usertable using the same logic as above

don't forget to clear the userAsRead if "mark as all read" is used, would save DB space

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!