Question

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?

Was it helpful?

Solution 2

install gem dalli-store-extensions https://github.com/defconomicron/dalli-store-extensions

In the Sweeper

expire_fragment /#{Regexp.escape(restaurant.id)}\/stocks*/

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top