Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:27565 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92061 invoked by uid 1010); 21 Jan 2007 16:33:54 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 92046 invoked from network); 21 Jan 2007 16:33:54 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jan 2007 16:33:54 -0000 Authentication-Results: pb1.pair.com header.from=pstradomski@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=pstradomski@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 66.249.92.170 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: pstradomski@gmail.com X-Host-Fingerprint: 66.249.92.170 ug-out-1314.google.com Linux 2.4/2.6 Received: from [66.249.92.170] ([66.249.92.170:16839] helo=ug-out-1314.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/DC-33373-2F593B54 for ; Sun, 21 Jan 2007 11:33:54 -0500 Received: by ug-out-1314.google.com with SMTP id o4so856075uge for ; Sun, 21 Jan 2007 08:33:51 -0800 (PST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:from:reply-to:to:subject:date:user-agent:references:in-reply-to:mime-version:content-disposition:message-id:content-type:content-transfer-encoding; b=ZLaPHE4JKhyLsIVEZsXNqipfyrVKIuGO535PXtVzwvqblSMKRsozQ/7pDJnTQZIhbDoQJ5zdet0cIp5b9TpnsFHbIxlqukcxHgoKGT4kfgKU+pr/yu8mUf9kuc+1Jl3Tq6ZVw5vU+x7oULKutOFD9kqQ6wGe3zMhZ+Fz/9Zi218= Received: by 10.67.103.7 with SMTP id f7mr6165032ugm.1169397231705; Sun, 21 Jan 2007 08:33:51 -0800 (PST) Received: from deimos ( [195.136.196.130]) by mx.google.com with ESMTP id m1sm4538268ugc.2007.01.21.08.33.51; Sun, 21 Jan 2007 08:33:51 -0800 (PST) Reply-To: =?iso-8859-2?q?Pawe=B3_Stradomski?= To: internals@lists.php.net Date: Sun, 21 Jan 2007 17:33:41 +0100 User-Agent: KMail/1.9.5 References: <45B0E1EE.2030102@widescreen.ch> <200701192122.38663.pstradomski@gmail.com> <45B39184.7010904@widescreen.ch> In-Reply-To: <45B39184.7010904@widescreen.ch> MIME-Version: 1.0 Content-Disposition: inline Message-ID: <200701211733.41473.pstradomski@gmail.com> Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] PHP Object-Caching and Reference Counting From: pstradomski@gmail.com (=?iso-8859-2?q?Pawe=B3_Stradomski?=) On 21 jan 2007 Lars Schultz wrote: > >Perhaps you could use your own reference counting? > >Keep your "real" objects in private array and instead of returning them > > return a simple object which would forward all methods and properties by > > __get/__set/__call. The constructor would increase your internal refcou= nt > > by one, destructor would decrease it. > > I use those objects quite often as they are used to access the database > to manipulate or search for related data. It wouldn't perform well and > is actually not at all practicable because there are so many classes for > which I'd would have to copy the interface. I don't see any place where you'd have to change the interface - except for= =20 the class which contains that private array; you can use the name of your=20 current class (MyObject)as the name of this new "forwarding" class and mak= e a=20 new name for the class which would be a copy of your current class (eg.=20 MyObject_private). Therefore in all function definitions required class=20 specification doesn't need to change. Well, perhaps you would have to change some "factory" class if you use one,= =20 but that should be a one place - if you kept your code clean. I think this solution is better, as you don't have to rely on internal=20 refcounts, which can be implemented in another way (or dropped altogether) = in=20 future releases. =2D-=20 Pawe=B3 Stradomski