Reputation: 1591
In my Rails app, I changed my model's find method to search into the cache before looking into the database, but I sometime get this error:
Memcached::ServerIsMarkedDead
While waiting for Memcached server to be up again, how should I handle this error and force Rails to search into the database?
Thank you,
Kevin
Upvotes: 1
Views: 1378
Reputation: 19485
You should be able to just rescue the exception and search the database in that case.
Rails.cache.fetch
encapsulates this pattern in a more generic way, and you may want to look into that instead of hacking find
, which is likely to bite you soon when Rails 3 comes out.
Upvotes: 1