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紅寶石