Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to delete a keys in memcached with regex (using Dalli+RoR).

How to delete a keys in memcached with regex (using Dalli+Rails)

  def expire_all
   expire_fragment(Regexp.new("/customers/customers"))
   expire_fragment(Regexp.new("/customers/customers\/"))
   expire_fragment(Regexp.new("/agreements/agreements"))
   expire_fragment(Regexp.new("/agreements/agreements\/"))
  end

Not working with memcached. Any Ideas?

like image 779
Ilhom Avatar asked May 25 '12 05:05

Ilhom


1 Answers

Memcached isn't able to iterate over its keys, so regexp expiration won't work. See the docs.

Take a look at this for a potential workaround, though it's labor intensive.

like image 116
x1a4 Avatar answered Sep 20 '22 15:09

x1a4