Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70127 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 53535 invoked from network); 14 Nov 2013 20:56:48 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 14 Nov 2013 20:56:48 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 108.166.43.123 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 108.166.43.123 smtp123.ord1c.emailsrvr.com Linux 2.6 Received: from [108.166.43.123] ([108.166.43.123:40427] helo=smtp123.ord1c.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 71/00-53459-F0935825 for ; Thu, 14 Nov 2013 15:56:47 -0500 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp8.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id 4B9801A00C9; Thu, 14 Nov 2013 15:56:44 -0500 (EST) X-Virus-Scanned: OK Received: by smtp8.relay.ord1c.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id ADEAE1A00CC; Thu, 14 Nov 2013 15:56:43 -0500 (EST) Message-ID: <5285390D.6000106@sugarcrm.com> Date: Thu, 14 Nov 2013 12:56:45 -0800 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Adam Harvey , Yasuo Ohgaki CC: "internals@lists.php.net" References: In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Session cache, lock and write From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > How do you propose to check if session data was changed? For scalar I think the best way is not to check, but to let the user tell you. I.e., I often found it useful to have some way to load session data, but then to drop the lock and not write anything. It may be useful for application which keeps the state in the session but changes the state rarely and only in some well-defined points - e.g. when the app is authorized (needs session for auth state) but only login/logout actually change this state. That would reduce network traffic by such app for session storage by almost 2x, even ignoring the fact that writes are usually more expensive than reads on the server end. >> Session module could have ini settings >> - session.lock = On/Off (On by default. Some save handlers already have >> this) > > I've got some concerns on this. I agree that it's a real issue — we do We could have read-with-no-lock semantics, but taking into account the above it's almost the same as read-with-lock+release-lock semantics, and given the protocols for some storage engines, may internally probably do exactly the same. Convenience function though may be useful. read-with-no-lock + write however is very dangerous proposition and I don't think we should support that - it makes, as you correctly pointed out, shooting oneself in the foot extremely easy. Which means for me that INI setting doesn't make a lot of sense, since you dont want ALL of your sessions be read-only - you need to write something to read something - and write without locks is a nightmare. -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227