Re: session_disconnect()

From: Date: Mon, 16 May 2011 13:41:29 +0000
Subject: Re: session_disconnect()
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-52390@lists.php.net to get a copy of this message
There is no function needed if you use http://php.net/manual/de/function.session-write-close.php like others do since ten years :-) if you know that you no longer write to the session use it this does not mean $_SESSION is lost it means only that changes to $_SESSIOn are not available for other requests Am 16.05.2011 15:37, schrieb Alain Williams: > I am working on some AJAX callbacks. These need to open the session, get hold of stuff in > $_SESSION > and that is it ... they won't be changing the session data. The trouble is that because > the > session file is locked the Asynchronicity of AJAX is reduced a bit, especially if some of the > server side calls need a lot of work. > > May I suggest: > > session_disconnect(); > > This would, in effect, close the session file but leave $_SESSION. This would be easy to > implement, > just call the second callback to session_set_save_handler(). > > This is NOT quite the same as a session_end() function since that would presumably write the > (changed) contents of $_SESSION back to where ever. With session_disconnect() any changes made > to $_SESSION would be lost regardless of them being made before or after the call to > session_disconnect(). > > Another way of doing this would be to add an optional boolean argument to session_start() which > would load $_SESSION and then disconnect. This is more intrusive in that changes to any user > open functions (of session_set_save_handler()) would be needed. It might be a tiny bit faster > or neater. > > > I do not know how much of a speed improvement this would make to what sort of AJAX > applications.

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.internals (#52390) next »