Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52389 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 71618 invoked from network); 16 May 2011 13:37:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 May 2011 13:37:58 -0000 Authentication-Results: pb1.pair.com smtp.mail=addw@phcomp.co.uk; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=addw@phcomp.co.uk; sender-id=permerror Received-SPF: pass (pb1.pair.com: domain phcomp.co.uk designates 80.68.91.63 as permitted sender) X-PHP-List-Original-Sender: addw@phcomp.co.uk X-Host-Fingerprint: 80.68.91.63 bytemark.phcomp.co.uk Received: from [80.68.91.63] ([80.68.91.63:41908] helo=bytemark.phcomp.co.uk) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4A/E6-26716-5B821DD4 for ; Mon, 16 May 2011 09:37:58 -0400 Received: from freshmint.phcomp.co.uk ([78.32.209.33] helo=mint.phcomp.co.uk) by bytemark.phcomp.co.uk with esmtps (TLSv1:AES256-SHA:256) (Exim 4.71) (envelope-from ) id 1QLxzd-0008KP-O9 for internals@lists.php.net; Mon, 16 May 2011 14:37:53 +0100 Received: from addw by mint.phcomp.co.uk with local (Exim 4.63) (envelope-from ) id 1QLxzd-0006VQ-8V for internals@lists.php.net; Mon, 16 May 2011 14:37:53 +0100 Date: Mon, 16 May 2011 14:37:53 +0100 To: internals@lists.php.net Message-ID: <20110516133753.GA24346@phcomp.co.uk> Mail-Followup-To: internals@lists.php.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.2i Organization: Parliament Hill Computers Ltd Subject: session_disconnect() From: addw@phcomp.co.uk (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. Regards -- Alain Williams Linux/GNU Consultant - Mail systems, Web sites, Networking, Programmer, IT Lecturer. +44 (0) 787 668 0256 http://www.phcomp.co.uk/ Parliament Hill Computers Ltd. Registration Information: http://www.phcomp.co.uk/contact.php #include