7 Sep
2000
7 Sep
'00
8:39 p.m.
Brian Lloyd writes:
Soren Rough writes
... application level cache ... ... application objects flushed (including cache)
One approach would be to cache your data in the module's namespace. For ex:
mycache={}
class MyClassThatKeepsGoingAway: ... def get_data(self, id): if mycache.has_key(id): return mycache[id] else: ...
Note that my example is a little contrived, since using a module variable means that you will have to implement this in a way that is safe for a multi-threaded environment. You can use a "SharedResource" for this:
URL:http://www.dieter.handshake.de/pyprojects/zope/SharedResource.html Dieter