I’m using Rails 3 with Memcached to cache some models. When the model changes, I want to invalidate the cache for that record. With view fragments, I just say expire_fragment("blah"). How do I do this with my models? I don’t want to say Rails.cache.clear and lose the whole thing. I want something like Rails.cache.invalidate("/users/5"). How do I do that?
I’m using Rails 3 with Memcached to cache some models. When the model changes,
Share
You did not mention at what point the model is actually added to the cache. You could try invalidating the model cache using the
after_savehook.