Forum: Ruby on Rails How to invalidate the model caching in ruby?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
3832c46fac01379dfa5b14c60fac8b5c?d=identicon&s=25 Vikas Gholap (vikas)
on 2009-02-23 08:38
Hello All,

I used rails caching to cache the model as  in model language.rb file

def self.cached_languages
    return Rails.cache.fetch('languages') { Language.all }
end


Now I want to add/delete some new language to database. So when the
table "languages" changes it should reflect in view. For that I want to
invalidate the cache.

please tell me How i do that?

Thanks,

Vikas.
This topic is locked and can not be replied to.