On 8/31/07, <b class="gmail_sendername">Bernd Dorn</b> <<a href="mailto:bernd.dorn@lovelysystems.com">bernd.dorn@lovelysystems.com</a>> wrote:<div><span class="gmail_quote"></span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
we use storm with zope (version .10) and discovered that the<br>store._cache attribute never caches, because the weakrefs are gone<br>immediatly</blockquote><div><br>Your conclusion is incorrect. The cache does work as intended; perhaps it is not what you want, though. The cache is there to prevent loading objects from the database when they are already in memory, and to avoid creating duplicate objects when the same row is loaded twice (if a row is retrieved a second time within the same transaction, the original object is updated instead of creating a new one).
<br><br></div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">we changed the implementation to use a normal dict, and do a<br>self._cache.clear() if an invalidate(None) is issued. which is done
<br>on commit and rollback. this makes sure there are no objects<br>referenced after a transaction<br><br>what about integrating this into storm?</blockquote><div><br><br>Probably not. It's not clear why this is necessary. The cache works fine. What problems did you have with its behavior?
<br><br>To be extra-clear: this patch will cause many Storm applications severe performance problems. There are many cases when it's necessary to process a large number of objects in a single transaction, and keeping *all* of those objects in memory for the life of the transaction is an unnecessary burden. For example:
<br><br>for object in store.find(Foo):<br> print <a href="http://object.name">object.name</a><br><br>while it may take a long time on a table where Foo has 100,000 items, at least won't keep all of those foo instances in memory. With your patch, it will.
<br><br>If your application calls for hard caching in a certain area, then you should probably implement the caching just for that portion of your application.<br><br></div></div>-- <br>Christopher Armstrong<br>International Man of Twistery
<br><a href="http://radix.twistedmatrix.com/">http://radix.twistedmatrix.com/</a><br><a href="http://twistedmatrix.com/">http://twistedmatrix.com/</a><br><a href="http://canonical.com/">http://canonical.com/</a><br>