- 红宝石 2.2.2p95
- 导轨 4.2.1
我的缓存生成运行良好。
索引页
http://localhost:3001/produtos
Write fragment views/localhost:3001/produtos (11.0ms)
分页页面
http://localhost:3001/produtos/pagina/2
Write fragment views/localhost:3001/produtos/pagina/2 (15.3ms)
但是我很难让它们过期。我正在使用清扫器使我的动作缓存过期,但我还没有弄清楚如何使分页页面过期。
class ProductsController < ApplicationControlle
caches_action [:show, :index]
end
class Admin::ProductsController < Admin::BaseController
cache_sweeper :product_sweeper
end
class ProductSweeper < ActionController::Caching::Sweeper
observe Product
def after_save(product)
expire_action products_url
expire_action category_product_url(category_id: product.category.slug)
end
end
如何使分页页面过期
http://localhost:3001/produtos/pagina/2
http://localhost:3001/produtos/pagina/3
http://localhost:3001/produtos/pagina/4
...
等等?