Jump to content

Is it possible to iterate over all active php sessions?


Recommended Posts

Hello,

 

I am building a site that is experiencing extremely rapid growth and I need to optimize my code as much as possible. One thing I am doing is trying to save trips to the mysql db by storing intermediate data in session variables, and I would like to save these session variables to the database only when these sessions expire. Could anyone figure out a way to do this? I have thought about using session_set_save_handler but my understanding is that if I use this function to write the session data to the database then php will just call those functions between requests and I will see the same kind of poor performance I'm currently seeing. I also thought about somehow iterating over all active sessions and pushing the ones to the db that are older than 10 minutes - but is this possible?

 

Any help is much appreciated.

 

Thanks

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.