몇 가지 액션 캐시가 만료 된 스위퍼가 있습니다. 디버거가 expire_action을 호출하기 직전에 중지하더라도 실제로는 동작이 만료되지 않습니다. 무슨 일이 벌어 질지 상상해?액션 캐싱이 호출되는 것을 볼 수있을 때라도 올바르게 만료되지 않습니다.
다음은 관련 스위퍼 및 컨트롤러입니다.
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 ('모델'디렉토리)
#의 company_sweeper.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
나는 그것이 만료 아니에요 알고있는 방법은, 전체 보고서는 이전 데이터를 반환하고 거의 즉각적으로 반응합니다. 이상하지, 그렇지?
전혀 생각하지 않으셨습니까? .... 누구? :-) – btelles