Memcached - clear all keys matching a pattern?

I have some pages that serve up a massive tree of html, with a few
different varieties used on different pages. Generating the html is
quite intensive so I use memcached to store the different flavours,
generating a different key for each flavour.

When the tree contents change, i need to clear these keys out of
memcached so they will be re-generated next time someone goes to the
pages. So far i’ve been flushing everything with CACHE.flush
(CACHE.flush_all locally) but it would be better to just flush the
relevant keys. Since the key names are also subject to change, but all
contain the fragment “property_tree” in their names, ideally i would
like to drop all keys matching against /property_tree/ and leave the

Is there a way to do this? I can’t see any way of getting memcached to
tell me all of it’s saved keys.


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs