[Zope] Persistence Problem

Andy McKay andy@agmweb.ca
Thu, 15 Aug 2002 18:04:20 -0700


> Occasionally, my _v_mycahce is empty when I didn't clear it. It looks like
> my product object gets dropped from memory, then reloaded, resulting in a
> missing cache.

Or you could be an a different thread since _v_ attribute is actually thread
specific.

> 2) Is there a server-lifetime class of objects? Is there a workaround to
get
> there? Can I force my object and its attributes to live in memory and not
> get purged until shutdown?

I havent tried it yet, but in 2.5.1 you could use the Temporary Folder....
--
  Andy McKay
  Agmweb Consulting
  http://www.agmweb.ca


----- Original Message -----
From: "Charlie Reiman" <creiman@kefta.com>
To: <zope@zope.org>
Sent: Thursday, August 15, 2002 5:55 PM
Subject: [Zope] Persistence Problem


> I've got a product that has a little pool of database connections. These
are
> low level DCOracle2 objects, not Zope DB connections. These live in a hash
> table-like cache living in a volatile attribute of a persistent product.
>
> Something like this:
>
> myproduct
>   _v_mycache
>     conn1
>     conn2
>     conn3
>
> The cache periodically reaps old connections. The product insures the
cache
> exists before it uses it, as it is volatile and might not exist at any
point
> in time. Here's my problem:
>
> Occasionally, my _v_mycahce is empty when I didn't clear it. It looks like
> my product object gets dropped from memory, then reloaded, resulting in a
> missing cache. If this is true then what I need is an class or attribute
> that is persistent for the server lifetime. It looks like all I can get
from
> Zope is permanent persistent objects or volatile objects.
>
> So my questions are:
>
> 1) Can I put a trap somewhere on my object so I know when it gets purged
or
> loaded? Just a simple "sys.stderr.write('loading\n')" would be enough to
> confirm my suspicions.
>
> 2) Is there a server-lifetime class of objects? Is there a workaround to
get
> there? Can I force my object and its attributes to live in memory and not
> get purged until shutdown?
>
> Thanks in advance. I think I can work around this with traditional coding
> kung-fu, but it'll be a pain. A solution like 'set this attribute to true'
> or 'subclass from twiddle' would make me really happy.
>
> Charlie.
>
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>