0
我使用cache_sweeper,caches_action。更新后,我需要重置对象的缓存。expire_action不会删除缓存页面
class ProductSweeper < ActionController::Caching::Sweeper
observe Product
def after_update(product)
expire_action(:controller => "/product", :action => "show", :url => product.url_was, :category => product.cats.first.url)
expire_action(:controller => '/catalog', :action => 'show', :url => product.cats.first.url)
end
end
后更新的控制台,我可以看到日志:
Expire fragment views/localhost:3000/catalog/cat1/prod123456 0.1ms
Expire fragment views/localhost:3000/catalog/cat1 0.0ms
,但文件不会被删除,并创下这些URL返回旧的缓存页面。什么是地狱(
?缓存文件被保存在%RAILS_ROOT%的/ tmp /缓存; Rails的3.2.19和1.9.3红宝石