-
-
CommentAuthorgreg
- CommentTimeMay 11th 2008
i'm working on putting together a new web site for an irc network with a logon system and control panel which integrates with services (if you;re not an irc nerd, disregard this
). rather than modify some forum software to use on this site i decided to make my own. one thing i'm not sure about is how to keep track of which users have viewed which post.
right now i have a system where each time a user views a thread, the most recent post id is logged in a mysql table along with their user id (so the table has two rows: user_id and post_id). if the user hasn't viewed that thread before, a new entry is added. if the user has viewed it before but there have been new posts since, the existing log is updated to reflect the latest post id.
this works really well right now with just a few users, but once the site goes live i'm worried that doing lookups for each thread and then updating values when a user looks at a thread could be quite costly, not to mention the log database table could get exponentially larger as the thread count and user count increases. this method also makes it quite complex to implement a 'mark all as read' system.
i'd love to hear people's opinions on how to tackle this problem - when i get some free time i plan to install some random php forums and take a look at how new posts are logged, but in the meantime i'd love to hear some different advice
-
-
-
CommentAuthorgnome
- CommentTimeMay 11th 2008
Here is my plan: only log the most recentn
threads, so that threads over a certain age get their tables dropped. Here, for example I would setn
to about 60, so tat people doing weekly marathon post reads never risk missing a thread.
If you are going to have branching conversations (IE not flat threads), then you will want each post to know who has or has not read that post, which is far worse in terms of efficiency. -
-
-
CommentAuthorgreg
- CommentTimeMay 15th 2008
thanks for the idea jason. i'm thinking of doing something similar to this but instead of monitoring the x latest posts, i will monitor all posts that have had activity within the last two weeks (or something). that way if an old post becomes active again it will still get its new posts logged. also, i'm going to use a timestamping method for the 'mark all as read' system. hopefully it all works out properly
-
1 to 3 of 3
