[Zope] ZODB drops _v_ attributes.

Etienne Labuschagne elabuschagne@gmsonline.co.za
Tue, 08 Apr 2003 17:14:24 +0200


Ok, hopefully the last question.

Normally (in my code anyway) I will instantiate the volatiles with the 
setstate method (in Zope programming anyway).

1. Is setstate Zope specific, or is it called for any ZODB persistent 
object (i.e. a stand-alone ZODB application)?
2. If my object turns into a ghost and after a while I start using it 
again, will setstate be called again (thus initialising the _v_'s again) or 
must I check manually that my _v_'s are still there, and do something if not?
3. Is there a way to force the refresh of an in-memory object so that 
setstate is called again (obviously, I can probably just call setstate 
manually by myself? But again - that needs a state parameter. . .)

Thanks for your very insightful answers so far!

Etienne


At 03:51 PM 4/8/2003 +0100, Toby Dickenson wrote:
>On Tuesday 08 April 2003 2:03 pm, Etienne Labuschagne wrote:
> > Just a question in general on this subject:
> >
> > When I retrieve an object out of a ZODB and that object instantiates some
> > volatile variables.  How long can I expect that object to hang on to those
> > volatile variables?
>
>The cache is flushed at the end of a transaction, and can be flushed 
>manually.
>At that time it currently uses a strict least-recently-used eviction policy,
>but that is not guaranteed in future.
>
>The volatile attribute is then lost - the same as all of that object's
>attributes. The only difference between volatile and non-volatile is that
>this attribute can not be recreated if the object is subsequently
>reactivated.
>
> > Shouldn't they last at least until I let go of my reference to the object?
>
>It has to keep the object in memory. Your reference has to point somewhere.
>
>If your object is evicted from cache then it loses its attributes and turns
>into a ghost. Doing anything else would mean that one accidental reference,
>or a circular reference, could keep a huge tree of objects in memory
>indefinitely.
>
>--
>Toby Dickenson
>http://www.geminidataloggers.com/people/tdickenson
>
>_______________________________________________
>Zope maillist  -  Zope@zope.org
>http://mail.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists -
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )