Re: [PHP-DEV] Weak references in PHP

[email protected] (Andi Gutmans)
Newsgroups php.dev
Message-ID <[email protected]>
Hi,

I don't quite understand. If you are thinking of implementing something 
similar to JDO then your persistent object manager will only hold the 
objects which are retrieve by the script. At the end of the request it'll 
persist the changes and will free the objects. Why would you want them to 
be destroyed during the request?

Andi

At 02:39 PM 2/28/2003 +0300, Konstantin Knizhnik wrote:
>To be able to implmenet interface of object-oriented database to PHP I need
>to
>have object cache which will map persistent object identifier (OPID) to
>loaded instance of the object. This cache should be "weak", i.e. it should
>not prevent garbage collection from deallocating unused instances of
>peristent object (otherwise all database will be soon loaded in memory)..
>
>As far as I understand, PHP uses GC bases on refernce couters. Also I do not
>find something like weak reference in language manual. There are two other
>ways how to solve the problem
>without weak references:
>1. Be able to check valye of reference counter (so I can check the it is
>equal to 1 and if so remove this object from object cache)
>2. Be able to detect the moment when object is removed by GC (in this case I
>can make object cache invisible for GC and when object is deleted, it will
>be also unlinked frmo object cache).
>
>Can anybody tell me if such features are available in PHP (I failed to find
>them myself).
>Or may be there is some other way to solve the problem?
>
>Thanks in advance
>Konstantin
>
>
>
>--
>PHP Development Mailing List <http://www.php.net/>
>To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.