Search code examples
ruby-on-railscachingmemcacheddalli

Rails.cache.clear certain key names?


Is it possible to somehow run Rails.cache.clear and only clear keys with a certain name/string?

I don't want to clear the entire cache...just keys with the string blog/post in the name (ie. blog/post/1, blog/post/2).

I'm using dalli with memcached for my cache and running Rails 3.0.6.


Solution

  • To answer my own question...it seems that given I'm using memcached, I actually can't use delete_if or delete_matched because memcached does not support enumerating or querying keys by pattern (1).