Hello,
I would like to make a server for a chat and I wonder whether a server must, for example,
connect to MySQL whenever a client enter to a room to check if he is moderator or banned from this room.
Is it necessary that I use MySQL to update the number of connected clients whenever a client go to another room(to display the number of connected clients on a web page)?
views:
49answers:
1I would like to make a server for a chat and I wonder whether a server must, for example, connect to MySQL whenever a client enter to a room to check if he is moderator or banned from this room.
If you don't read it from the database each time it is possible that you may have an out-of-date cache (if the database was modified by you or another program since your server last read from the database). If you can't live with slightly out-of-date information then you should read from the database each time.
Is it necessary that I use MySQL to update the number of connected clients whenever a client go to another room(to display the number of connected clients on a web page)?
No, the count of the currently online clients can be stored in memory. It does not need to be persisted.