Search code examples
databaseread-unread

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


For example, let's take the format of a forum, where we have multiple users and multiple threads. Say this forum wants to track which users have read which threads and, say, use that information to mark which threads are unread when viewing the thread list.

The only solution I can imagine is something that drops a record into the database each time a user visits a thread. I suppose there could be a 'mark all as read' button, which could employ a time stamp to help lessen the sprawl in the database... regardless this isn't a solution that impresses me.

I have a feeling that I'm missing something here... maybe Thanksgiving morning isn't the time to think over one's programming problems.

Is there a better solution out there for this? Any ideas?


Solution

    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.