SV: [ZODB-Dev] Flush

Jeremy Hylton jeremy@zope.com
Thu, 31 Jan 2002 01:57:22 -0500


>>>>> "MH" == Magnus Heino <magnus.heino@pleon.sigma.se> writes:

  >> >Can I make the ZODB not flush an object out from memory once it
  >> >has been loaded from disk?
  >>
  >> Using the C API yes. Look at PER_PREVENT_DEACTIVATION in
  >> cPersistence.h
  >>
  >> You cant do this from python. Why do you want to?

  MH> Because the object does start_new_thread in __setstate__, and
  MH> _setstate__ is called every now and then... :-P

That's enough of answer for me to worry about what you're doing :-).
I'm not sure I understand why you're trying to accomplish, but I think
you need to add more sophistication to your __setstate__().

I believe part of the contract you sign up for as a Persistent object
is that you agree to let your data manager (connection/ZODB) be
responsible for deciding when to load and unload the object from
memory.  In other words, ZODB decides when to call __getstate__() and
__setstate__().  It doesn't provide any direct mechanism for the
programmer to control when they get called.

What is the thread doing in __setstate__()?

Jeremy