Thankyou James. That certainly helps me understand why...<br><br><div class="gmail_quote">On Sun, Mar 13, 2011 at 10:01 AM, <a href="mailto:james@jamesh.id.au">james@jamesh.id.au</a> <span dir="ltr"><<a href="mailto:james@jamesh.id.au">james@jamesh.id.au</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div class="im">On Fri, Mar 11, 2011 at 6:51 AM, Roy Mathew <<a href="mailto:rmathew8@gmail.com">rmathew8@gmail.com</a>> wrote:<br>

> Hi Gustavo, Thanks for your reply.<br>
> My assumption was that the the goal of caching was to avoid making the<br>
> same query more than once in a given transaction.<br>
> However, my (perhaps flawed) analysis after a bit of digging suggests<br>
> that this is not the case, and the caching model used in the storm<br>
> container is more about managing objects in memory that correspond to<br>
> table rows, and doing the right thing as far as their state is concerned<br>
> when dirty, etc...<br>
> Our application uses a SQL container model. I turned on logging on<br>
> the postgres backend, and saw that doing something like this inside<br>
> a transaction:<br>
>   obj1 = C['key1']<br>
>   obj1 = C['key1'] # and again<br>
> (that is to say, it seems that invoking __getitem__ twice), causes the<br>
> same SQL query to run twice. Please help me understand if I<br>
> understand this correctly. thanks!<br>
<br>
</div>Storm's object cache works off of the table's primary key.  It doesn't<br>
have any knowledge of any alternative keys for the table, so queries<br>
that rely on those keys won't benefit from the cache.<br>
<br>
As a general rule, calls to Store.get() (and code that calls it, such<br>
as References to the primary key of a table) may avoid a query if<br>
there is a cache hit, while calls to Store.find() will always issue a<br>
query.<br>
<font color="#888888"><br>
James.<br>
</font></blockquote></div><br><br clear="all"><br>-- <br>Roy.<br>