Partial Flush?

dormando dormando at rydia.net
Thu Aug 30 22:41:34 UTC 2007


Sam Washburn wrote:
> Hello list!
> 
> I'm wondering if this question has been asked before and hopefully replied
> to with a good answer :)
> 
> We have several domains that use the same code base but independent objects
> in memcache.  The memcache keys I use for each domain are
> hostname+identifier.  One particular function(a user activated feature)
> radically changes the state of the site and requires a flush so as not to
> leave traces of the previous state.  Our code currently uses flush() to
> perform this action.

A few times ;)

So there are a few proposals to allow more generational caching which 
Dustin pointed to you (wiki it!), but I see an easy route for you.

If you're interesting in implementing something that's merge-able, I 
don't want to discourage you :) But as an alternative, if you're already 
using hostname+identifier as a key prefix, you can add one more and make 
the whole set "ghetto generational"

Just add a serial number somewhere (cache it locally, in another key, 
whatever): hostname+id+serial

User activates feature, serial++, then magically all of their own data 
is gone. The LRU will push it out eventually if needed.

I ... might've ... put this up an example on the wiki. It's been 
credited to someone else. I'll check and add later if not.

-Dormando


More information about the memcached mailing list