我使用Rails.cache.fetch(method_name,:expires_in => 15.minutes)来缓存数据。当我更新一列时,更新的列仅在15分钟后才会显示在页面中。有没有办法我只能清除更新记录的缓存?
您可以使用清除整个缓存Rails.cache.clear。
Rails.cache.clear
要清除单个条目,请使用Rails.cache.delete(method_name)。
Rails.cache.delete(method_name)
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
点击生成二维码
我来说两句