I imagine there are a few different ways. A naive way would be: - Have a database table "OnlineUsers": with "id" and "time" fields - In your User class, in the initialize method either - Insert a new row to the table, and store the ID in the session (as a User attribute) - If there is already an ID in the session, update the row with the ID with the current time
Then, in a slot, you could query the database to find out how many people have looked at a page in the last X minutes, to get the number of online users. *However*, this would mean 2 database requests per page load. So you could - Use caching on the slot, with a lifetime of X minutes - Also store "time" in session, and then only update the time in the database if the last page load time by that user was more than X minutes ago. Michal. On 16 Jan 2010, at 20:49, Mahmood reza Delfieh wrote: > Hello > > Gow can I count numbers of online users? > > Best Regards > Mahmood > > _______________________________________________ > users mailing list > [email protected] > http://lists.agavi.org/mailman/listinfo/users
_______________________________________________ users mailing list [email protected] http://lists.agavi.org/mailman/listinfo/users
