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

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to