Ruby on rails 过期行动不';不要删除缓存页
我使用缓存清理器,缓存操作。更新后,我需要重置对象的缓存Ruby on rails 过期行动不';不要删除缓存页,ruby-on-rails,caching,Ruby On Rails,Caching,我使用缓存清理器,缓存操作。更新后,我需要重置对象的缓存 class ProductSweeper < ActionController::Caching::Sweeper observe Product def after_update(product) expire_action(:controller => "/product", :action => "show", :url => product.url_was, :category =>
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
,但文件不会被删除,点击这些URL会返回旧的缓存页面。。怎么回事(
缓存文件保存在%rails\u root%/tmp/cache;
Rails 3.2.19和ruby 1.9.3刚刚解决了这个问题,
product.cats.first.url
;缓存只为一个类别清除了一个愚蠢的错误。如果您有类似的问题,请仔细检查请求url和清除的url是否相同
Expire fragment views/localhost:3000/catalog/cat1/prod123456 0.1ms
Expire fragment views/localhost:3000/catalog/cat1 0.0ms