caching - Invalidate a specific model in the Rails cache -


I'm using Rail 3 with Memcached to cache some models. When the model changes, I want to invalidate the cache for that record. With pieces of the scene, I just say expire_fragment ("blah") . How can I do this with my model? I do not want to say rings.cache.clear and I lose everything. I need something like rails.cache.invalidate ("/ users / 5") . How do i do this

You did not mention that the model has actually been added to the cache. You can invalidate the model cache using the after_save hook.

  class models & lt; After AR: Base: Sacrifice invalid invalid services Private invalid rails.cache.delete ("/ user / # {self.id}") End and    

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -