How do I expire a view cached fragment from console?

前端 未结 4 913
耶瑟儿~
耶瑟儿~ 2020-12-28 16:53

Something like

Rails.cache.delete(\'site_search_form\')

doesn\'t seem to work. Is this possible? Thanks.

4条回答
  •  无人及你
    2020-12-28 17:40

    Cache fragment entries are created with a slightly different key than what you access with Rails.cache.

    Use expire_fragment instead (you can send it to a controller): http://api.rubyonrails.org/classes/ActionController/Caching/Fragments.html#M000438

提交回复
热议问题