いくつかのアクション キャッシュを期限切れにするはずのスイーパーがあります。デバッガーは expire_action の呼び出しの直前に停止しますが、実際にはアクションが期限切れになるわけではありません。何が起こっているのでしょうか?
関連するスイーパーとコントローラーは次のとおりです。
#company_sweeper.rb (「モデル」ディレクトリ内)
class CompanySweeper < ActionController::Caching::Sweeper
observe Company
def after_save(company)
expire_cache(company) if company.final_save && company.valid?
end
def expire_cache(company)
debugger <= #debugger stops here!
right before the call
I'm trying to make.
expire_action :controller => 'reports',
:action => 'full_report'
end
end
#reports_controller.rb
class ReportsController < ApplicationController
layout false
caches_action :full_report, :supplier_list, :service_categories
cache_sweeper :company_sweeper
def full_report
#do stuff...
end
end
有効期限が切れていないことを私が知る方法は、完全なレポートが古いデータを返し、ほぼ瞬時に応答することです。変ですよね?