From: Ian B. <ia...@co...> - 2003-10-27 20:43:34
|
On Monday, October 27, 2003, at 02:12 PM, Sidnei da Silva wrote: > Howdy again, > > I am in the process on getting the Zope3+SQLObject integration to the > next level, which is optimization. I haven't started profiling yet, > but one of the things that I would like to try is to enable cache on > SQLObject (I disabled it since the start because it was getting too > much in the way) and hook with the event system in Zope 3 to process > cache invalidation when an ObjectModified message comes > through. However I am not sure about the way the SQLObject.expired() > method is implemented. It seems that it is doing a bit more than > expiring the cache, it is also marking the object as expired and > removing something from the instance which I'm not sure what it > is. The way I see it, I should probaly call expired() which would > mark the object as expired and clear the cache for that object. On the > first attribute access after that, SQLObject would find the cache is > empty, fetch the live values from database and remove the expired mark > from the object. Maybe a revalidate() method on SQLObject could do it, > to make it simpler. Am I close? SQLObject.expire() expires the *instance's* cache of its column values. When you create an instance, it gets its column values from the database immediately. When a transaction is rolled back we expire all the effected instances' caches so that they don't contain stale information from a rolled-back transaction. (There perhaps should be other circumstances where we automatically expire instances, but I haven't thought that through). The per-connection cache is a different issue. I'm not sure what SQLObject should do for an ObjectModified message. What does this message mean? There's also the issue of non-column instance variables (which you might manually add to a SQLObject subclass) and rolling those values back... that might be related, or maybe you are avoiding that issue entirely for the moment. -- Ian Bicking | ia...@co... | http://blog.ianbicking.org |