Re: session lost problem

From: Date: Tue, 24 Apr 2012 07:59:59 +0000
Subject: Re: session lost problem
References: 1 2 3 4 5 6  Groups: php.general 
Request: Send a blank email to php-general+get-317661@lists.php.net to get a copy of this message
2012/4/24 marco@behnke.biz <marco@behnke.biz> > > > bug zhu <bugwhen@gmail.com> hat am 24. April 2012 um 08:28 geschrieben: > > > thank you for your explanation, > > when i write to $_SESSION after session_commit(),$_SESSION is just a > > regular array > > Yes. Actually session_commit does not "terminate" the session as mentioned > earlier but is closes it for writing. You cann still read session values. > > The benefit of using session_commit is that the server saved associated > session file is no longer locked, so that parallel requests can both access > the values. > > The approach ist as follows: > Call session_commit() as early in you code (after session_open) as possible > to avoid locking. So first do all the writing to the $_SESSION array, then > do write close (or commit). After that you can still read all session > relevant information. > > If you want to write afterwards to your $_SESSIOn array you simply have to > call session_start to re-open the write context. Afterwards you can commit > it again to remove the lock. > > But be careful! session_start and session_commit perform write operations > on your harddisk or whatever storage you use. Many calls to start and > commit will result in losing performance. > > Regards, > Marco > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > got it, very appreciate you explanation:-) -- thanks, bugzhu

« previous php.general (#317661) next »