<div>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">My main confusion or concern with memcache is how to<br>go about deleting a given set of keys in the<br>cache. For instance, we probably have 10-15 pages on
<br>our site that hit the "articles" tables in our<br>database. So, that right there would be 10-15 unique<br>key/value pairs in memcache, assuming I store the<br>query as the key, and the result set as the value. Now
<br>add on dynamic search strings, pagination, etc, and<br>you've probably got 100 unique key/value pairs in<br>memcache, all pertaining to articles.<br><br>So my question is, if we want to make sure our site is<br>never stale, then we need to invalidate all 100 of
<br>those keys if someone inserts a new article. Now I'm<br>thinking I need to do a search in my keys to find all<br>article related keys and invalidate them.<br><br>Is the best way to do this then to store ANOTHER key
<br>value pair which essentially stores all the article<br>related keys as its value? So that I can quickly and<br>easily invalidate the 100 other keys?<br><br>It seems like this might be what "namespaces" are for,
<br>but I can't understand the example given on the<br>memcached FAG page.<br><br>Any help and direction in this area would be much<br>appreciated, or any other good articles I should read<br>that talk about best practices, implementation
<br>techniques, etc.</blockquote>
<div> </div>
<div>I'm facing the same problem here. From the responses I'm guessing that most of you think it's better to cache each individual "article" and perhaps the article titles for display. Listings still hit the database directly. The only savings would be that the app wouldn't have to do another SQL to fetch the article titles/links/data, as it can get it from the cache.
<br> </div>
<div>However, is there no way to cache these pages effectively? For instance, what if say I set a default expiration time for anything that's not on page 1. Then whenever an article gets inserted, the first 10 pages are purged, while pages 11 onwards are expired on their own.
</div>
<div> </div>
<div>What do you guys think of this solution?</div>
<div> </div></div>