Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54338 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26262 invoked from network); 4 Aug 2011 08:37:51 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Aug 2011 08:37:51 -0000 Authentication-Results: pb1.pair.com smtp.mail=lester@lsces.co.uk; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=lester@lsces.co.uk; sender-id=unknown Received-SPF: error (pb1.pair.com: domain lsces.co.uk from 213.123.20.131 cause and error) X-PHP-List-Original-Sender: lester@lsces.co.uk X-Host-Fingerprint: 213.123.20.131 c2bthomr13.btconnect.com Received: from [213.123.20.131] ([213.123.20.131:40499] helo=mail.btconnect.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 57/31-18399-E5A5A3E4 for ; Thu, 04 Aug 2011 04:37:50 -0400 Received: from [10.0.0.4] (host81-138-11-136.in-addr.btopenworld.com [81.138.11.136]) by c2bthomr13.btconnect.com (MOS 4.2.2-FCS) with ESMTP id DWH07941; Thu, 4 Aug 2011 09:37:36 +0100 X-Mirapoint-IP-Reputation: reputation=Fair-1, source=Queried, refid=tid=0001.0A0B0303.4E3A5A50.0056, actions=tag Message-ID: <4E3A5A50.30707@lsces.co.uk> Date: Thu, 04 Aug 2011 09:37:36 +0100 User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.19) Gecko/20110420 SUSE/2.0.14-2.2 SeaMonkey/2.0.14 MIME-Version: 1.0 To: PHP internals References: <4E3898B0.40809@sugarcrm.com> <4E38EC0C.9080304@lerdorf.com> <4E38FA2E.4030605@lsces.co.uk> <4E38FC67.9090200@toolpark.com> <4E39E89F.8060605@sugarcrm.com> <4E3A3643.2070305@toolpark.com> <4E3A4793.2070209@sugarcrm.com> In-Reply-To: <4E3A4793.2070209@sugarcrm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Junkmail-Premium-Raw: score=7/50, refid=2.7.2:2011.8.4.74814:17:7.586, ip=81.138.11.136, rules=__MOZILLA_MSGID, __HAS_MSGID, __SANE_MSGID, __USER_AGENT, __MIME_VERSION, __TO_MALFORMED_2, __BOUNCE_CHALLENGE_SUBJ, __BOUNCE_NDR_SUBJ_EXEMPT, __CT, __CT_TEXT_PLAIN, __CTE, __ANY_URI, __URI_NO_MAILTO, __CP_URI_IN_BODY, BODY_SIZE_1300_1399, BODYTEXTP_SIZE_3000_LESS, __MIME_TEXT_ONLY, RDNS_GENERIC_POOLED, BODY_SIZE_5000_LESS, RDNS_SUSP_GENERIC, RDNS_SUSP, BODY_SIZE_2000_LESS, BODY_SIZE_7000_LESS X-Junkmail-Status: score=10/50, host=c2bthomr13.btconnect.com X-Junkmail-Signature-Raw: score=unknown, refid=str=0001.0A0B020C.4E3A5A5B.010F,ss=1,fgs=0, ip=0.0.0.0, so=2010-07-22 22:03:31, dmn=2009-09-10 00:05:08, mode=multiengine X-Junkmail-IWF: false Subject: Re: [PHP-DEV] [VOTE] Weak References From: lester@lsces.co.uk (Lester Caine) Stas Malyshev wrote: >> I am open to any suggestions how I could solve my problem without >> WeakReference or zval-refcount (short of keeping a ref-count in >> userland). > > Do not keep object references, keep object IDs. This would make your > code a bit more verbose and a bit slower, but weak refs would > essentially do the same anyway. Like you Stas I am having trouble understanding what the problem is ... On one 'project' I'm playing with I build a tree of genealogical references in memory, all identified by their unique_id. If the person has already been loaded, then it simply uses the existing reference for that element of the tree. If there is a change to data for some reason the 'cached' record is deleted so that it has to be re-read from the database next time it's accessed ... if it is accessed at all. Persons are all class objects ... so deleting is just marking the object as invalid at which point ( I hope ) the underlying data is dropped. -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk// Firebird - http://www.firebirdsql.org/index.php