Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter 1.7 Session Class
#1

[eluser]drewbee[/eluser]
I know this may seem a bit unorthodox, and I get a bit crazy about performance especially in relation to queries, but why is the session class doing a database query on every single set_userdata() and unset_userdata() call?

A far more optimized version would hold all updates until the end of script execution. I am rather tired right now, so I may be mis-reading the code, but this is what it looks like to me, then makes an additional query to update the last_active and session_id column after the should the configuration option sess_time_to_expire passes.

The way I see everything flowing it should be a pretty simple top to bottom level

IE.
Query database for any session data > do all in-process updates local to the object > at end of script update all changes to the database. Their shouldn't be anymore then two queries top to bottom in the session class (select and update (or insert if a creation)).

Is their any reason for this? It seems like way more overhead then what is needed... please tell me I am just reading code wrong...

Thoughts?


Messages In This Thread
CodeIgniter 1.7 Session Class - by El Forum - 10-08-2008, 03:25 PM
CodeIgniter 1.7 Session Class - by El Forum - 10-08-2008, 04:07 PM
CodeIgniter 1.7 Session Class - by El Forum - 10-08-2008, 05:41 PM
CodeIgniter 1.7 Session Class - by El Forum - 10-08-2008, 05:56 PM



Theme © iAndrew 2016 - Forum software by © MyBB