Module Cache Sweeping
プロジェクトのappの下にディレクトリsweeperを新規作成し、リストなどのsweeperクラスのファイルを新規作成します.sweeper.rb class
対応するコントローラでは、
config/application.rbにロードする必要があります
class ListenSweeper < ActionController::Caching::Sweeper
observer User, Production #observer Model you wanted
def after_save(record)
end
def after_update(record)
end
def after_destroy(record)
end
private
def do_something
expire_page(:controller => "lists", :action => %w( show public feed ), :id => list.id)
expire_action(:controller => "lists", :action => "all")
end
end
対応するコントローラでは、
cache_sweeper :listen_sweeper, :only => [:action_one, :action_two]
config/application.rbにロードする必要があります
config.autoload_paths += %W(#{Rails.root}/app/sweepers)