Jump to content

Archived

This topic is now archived and is closed to further replies.

lead2gold

$_SESSION Information

Recommended Posts

What is the limit as to how much you can store in a $_SESSION variable once a session has been started?
I havn't hit the limit yet (whatever that is), but i do tend to store information i should probably reconsider doing.

Currently i store it as:
$_SESSION['user_id'] = <Currently logged in Users RIN #>
$_SESSION['axs_id'] = <Access Level >

now the above i consider pretty standard... it's whats below that has me worried.
I allow the expanding and collapsing of tables by clicking a {+/-} listing information below.. ie:

$_SESSION['user_list']['Admin']= {0/1}
$_SESSION['user_list']['Reg']= {0/1}
$_SESSION['user_list']['Guest']= {0/1}
$_SESSION['team_list']['<team name here>']= {0/1}
$_SESSION['team_list']['<team name here>']= {0/1}
$_SESSION['team_list']['<team name here>']= {0/1}
.... etc


With enough expand/collapse pages and having a user visit each one (thus populating alot of the $_SESSION variable with memory tracking)... could i potentially exceed the Session Limit?

Share this post


Link to post
Share on other sites
nothing in computing is limitless, however i have (so far) found no reason to worry about the size of session data. storing the odd character here, number there, etc,will not really amount to enough to cause major problems.

when a session is started, a file is created on the server which holds your info. when your session expires (or you close your browser) the session file ceases to exist.

if i'm honest, i'm not sure if there is any 'set' limit on session size. if their isn't, then the size would be determined by how much space is actually used by all of the session files on the server.

if youre that worried about how much you store, then simply look through your code and see if you are storing info that NEEDS to be stored (ie, preloading an entire database wouldnt be advisable). user info, users settings, etc are fine. but entire lists of teams and team data would probably be better on your server if they were read from the database as required, rather than stored.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.