How do i obtain the object again having just the key when i want to return it in another call, if i don't have a reference somewhere? The point would be: object asked id #1, it is not already loaded, load it and return it, end. Then, in another call: object asked id #1, it is already loaded, return the same instance already in memory, end. And outside of this function, if all references of that object are deleted, then the object is unloaded from memory and so destructed. The behavior i want to reach is that if an instance of some specific class has the same $id that another instance, then they are the same instance. It's for a database persistent object framework. Everyone that tries to program such a framework gets to the same problem.
Regards Leo On Tuesday 10 May 2005 11:57, you wrote: > Leonardo Pedretti wrote: > > Yes, the question was pointed in another way, the destructors are not > > called until the last reference to an object has been removed, but if you > > store a reference in an array so you lately return a reference to the > > already loaded instance instead of creating an aliasing of that instance, > > then you get the undesirable behavior that the object is never destroyed > > until the script ends, because there is always a reference in that array > > and you can not check when references are removed in any way. > > And leaving the array growing while each object that exists in a huge > > database is slowly loaded and never unloaded, is not an option. > > then dont store a reference to the object but instead just store the key > in the array. > > regards, > Lukas -- Leonardo Pedretti Axon Sistemas Líder de Equipo Proyecto Basalto -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php