如何使控制台中的视图缓存片段过期? [英] How do I expire a view cached fragment from console?

查看:58
本文介绍了如何使控制台中的视图缓存片段过期?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似

Rails.cache.delete('site_search_form')

似乎无效。这可能吗?谢谢。

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

推荐答案

创建缓存片段条目的键与使用Rails.cache访问的键稍有不同。

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

改为使用 expire_fragment (您可以将其发送到控制器): http://api.rubyonrails.org/classes/ActionController/Caching/Fragments.html#M000438

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

这篇关于如何使控制台中的视图缓存片段过期?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆