Home Play Pinja Bobbity flop

A blog about Ruby, Rails and other Tech. Mostly.

Back to blog

1st Nov 2006, 8:55pm
Ruby on rails: expire_fragment using regexp is broken with memcached

My rails application broke badly when I installed memcached.

I was using this kind of thing to expire my fragments:

expire_fragment %r{w+d+/index/.*}

Well, it turns out that both Ruby-MemCache, and memcache-client do not support this.

Internally rails calls delete_if on the cache object. But the memcached clients do not have a delete_if method, or indeed way of iterating over cached items.

For the cache client (and the cache itself probably, I haven't looked at the API) it may be reasonable not to provide a way to iterate over all keys in the store - there could be very many and performance could be an issue.

But this means no delete_if in the client, and no expiry by regexp. I thought that at least it should be documented so I made a new ticket.

And in the end I came up with my own mechanism for tracking cached items - I will post it here later.


Back to blog