I'm currently working on a project where users are required to log in to use the site. Anyhow, in MySQL each user has certain options pertaining to their account - limitations, paths to local files, preferences, etc. How it works right now is, each time any of these values are needed, it's looked up in MySQL.

Would it be worth the server load to just store these values as session variables after the user logs in?

Or, in the functions that retrieve these values - check if the session variable exists, and if it doesn't then load it in at that time? So the first time each value is need it is stored in the session. If anything happens to it, then it will get it from MySQL and once again save it in the session.

What do you think?

Thanks