title: Rails Expire action using regex expression with Memcache
body: <p>Iam working on a Rails application and have integrated caching with memcache using Dalli. Iam working on action caching and expiring cache using sweepers. 
  My sweeper code looks like this:</p>
  
  <pre><code>class BoardSweeper &lt; ActionController::Caching::Sweeper
    observe Board
  
    def after_create(board)
      expire_cache(board)
    end
  
    def expire_cache(board)
     expire_action :controller =&gt; :boards, :action =&gt; :show, :id =&gt; "#{board.id}-#{board.title.parameterize}"
    end
  
  end
  </code></pre>
  
  <p>But I want to delete the cache using regex expression i.e. I want to match the url and delete the cache just like:</p>
  
  <p><em>If my board show url's are like:</em></p>
  
  <pre><code> "boards/1/likes-collection-of-branded-products.text/javascript"
   "boards/1/likes-collection-of-branded-products.text/html"
  </code></pre>
  
  <p><em>Then I want to use the following expression to expire the cache:</em></p>
  
  <pre><code> Rails.cache.delete_matched(/boards\/1.*/) 
  </code></pre>
  
  <p>But as per the <a href="http://api.rubyonrails.org/classes/ActiveSupport/Cache/MemCacheStore.html#method-i-read_multi" rel="nofollow">memcache api doc</a> it doesnt support <strong>delete_matched</strong> method.</p>
  
  <p>Iam sure there should be some way to delete on basis of regex. Please help.</p>
  
  <p>Many Thanks!! </p>