[Zope] Clearing _v_ attributes

Andrew Milton akm at theinternet.com.au
Wed Jan 19 06:51:02 EST 2005


+-------[ Pascal Peregrina ]----------------------
| If I do a clearCaches() method that clears _v_ attributes on the object, how
| can I make sure it will clear these attributes in all the Zope connections
| that may have a cached copy of the object ?

Basically you can't. Although if a thread doesn't wake up for 10 mins (with
your object), then odds are it'll get thrown out and brought back in again
without the _v_ attributes set, so it's probably a moot point.

You would have to grab each ZODB connection present, grab your object and call
the method.. That's just getting in voodoo you probably don't actually need.

The best you could do would be to set a flag / timestamp. Any object that woke
up would have to check that timestamp and work out whether to flush at that point 
or not.

| Or do you mean that clearCaches() should do the self._p_changed=1 ?

_p_changed = 1 won't flush your _v_ attributes.

-- 
Andrew Milton
akm at theinternet.com.au


More information about the Zope mailing list