<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On Sep 29, 2007, at 0:43, K J wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>For instance, suppose I have voting for comments, and users can filter by votes (like digg/youtube/slashdot).  I set a memcache list for every filter.  However when there are changes to a particular comment's vote score, the list would be invalidated.  Imagine if there is a lot of voting going on, it would mean the filter lists are constantly being reloaded by the database?</DIV></SPAN></BLOCKQUOTE><BR></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>That just doesn't sound expensive to me.  If you have each comment in its own cache entry, and a cache entry for the list, you can replace the components or the list independently, and then do one cache query to get the list, to convert the id list to a comment list.  If the list, or any comments are missing, you'll, of course, need to fetch those.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>After that, your filter op can happen on the client:</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV>comments = [c for c in all_comments if c.rating &gt; 2]</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>You can cache *that* as well if you do find it to be expensive to recreate.  Then you just need to clear potentially cached filtrations when updating comments or comment lists.</DIV><DIV><BR class="khtml-block-placeholder"></DIV><DIV><SPAN class="Apple-tab-span" style="white-space:pre">        </SPAN>Using the above, I'd expect you to be able to have excellent cache accuracy and really good performance.</DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV>-- </DIV><DIV>Dustin Sallings</DIV><BR class="Apple-interchange-newline"></SPAN> </DIV><BR></BODY></HTML>