I have written myself a custom forum script using php. I decided against using phpbb and others as I wanted 100% flexibility with what I was doing.
I\'ve hit a problem
A session would be a good place to store this. I'd imagine you'd only want to store the data for the last "n" threads that a user looks at or only for threads in the last "n" days.
As someone has suggested in one of the comments it's worth looking at some of the existing forums out there and see how they implement this.
While I think it's a great learning opportunity to write your own forum software in terms of efficiency of building it yourself I think that you're re-inventing the wheel somewhat.