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

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Vikas G. (Guest)
on 2009-02-23 09: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 }

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?


This topic is locked and can not be replied to.