A seemingly simple problem with a complex solution?
I'm writing some forum software and I need to keep track of users viewing threads.
I need to be able to mark each thread as unread or read, depending on whether the user has visited it before the last post was posted or after.
At first I thought I could track the user's time of the user's last view of the forum the thread is in.
The problem there is that if the user views one thread then goes back to the forum, all threads are unread.
Then I thought I could make a new table in the database - something like:
UserID | ThreadID | LastViewtime
(_ = whitespace)
- This would work flawlessly, but when there are 1000 views on one thread, and one million threads, there would be enormous overhead there.
Now I'm thinking of setting a cookie on the user's machine for each thread, then recalling the cookie for that thread when needed.
I'm just not sure how feasable this is. How would I go about saving/restoring ALL these cookies when the user logs in/out without enormous overhead. How slow/annoying/whatever would it be for the user (and the user's browser and computer) to be storing all these cookies?