SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jan 2006
    Posts
    96
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What should you store in session variables?

    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

  2. #2
    SitePoint Evangelist superuser2's Avatar
    Join Date
    Aug 2006
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think permissions and options should be loaded into the session array at login. Less mysql queries -> better performance (faster).

  3. #3
    SitePoint Evangelist ldivinag's Avatar
    Join Date
    Jan 2005
    Location
    N37 33* W122 3*
    Posts
    414
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ditto with arrays.

    let's you pass them from form to form much easier, if needed.
    leo d.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •