Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 过期行动不';不要删除缓存页_Ruby On Rails_Caching - Fatal编程技术网

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