iarp Posted January 18, 2013 Share Posted January 18, 2013 I'm in the middle of creating a system, I've just started working on the login script, each login will have custom settings that override the global setting. Is the cost of contacting the database greater than calling $_SESSION to a point that it's not worth calling the database every time? Or is it close enough it's worth it, and not having to then manage updating the database and the session variables when items are changed. Quote Link to comment https://forums.phpfreaks.com/topic/273336-database-calls-every-page-hit-or-save-in-_session/ Share on other sites More sharing options...
requinix Posted January 18, 2013 Share Posted January 18, 2013 Unless you have something unusual you'll do a lot more reading than writing. Keep it in the session (or a cache) and update your database when it changes. Quote Link to comment https://forums.phpfreaks.com/topic/273336-database-calls-every-page-hit-or-save-in-_session/#findComment-1406795 Share on other sites More sharing options...
PFMaBiSmAd Posted January 19, 2013 Share Posted January 19, 2013 If your log in system has a need to dynamically alter a user's status, such as suspend/ban a member or to promote/demote a member without needing them to re-login for the status change to take effect, you would need to read the database on each page load. Quote Link to comment https://forums.phpfreaks.com/topic/273336-database-calls-every-page-hit-or-save-in-_session/#findComment-1406949 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.