내 응용 프로그램에서 작업 캐시가 만료되는 데 문제가 있습니다.custom cache_path가있는 작업 캐시 만료
여기 내 컨트롤러 : 어떻게 든 사용자 지정 캐시 경로를 재설정 할 수 있어야합니다
class ToplistsController < ApplicationController
caches_action :songs, cache_path: :custom_cache_path.to_proc
def custom_cache_path
"#{params[:when]}-#{params[:what]}-#{params[:controller]}-#{params[:action]}"
end
def songs
# ...
end
end
,하지만 난 방법을 알아낼 수 없습니다.
저는 이미 this technique을 사용해 보았습니다. 성공하지 못했습니다. 내 캐시 엔진 인 Dalli는 regexp matcher를 지원하지 않습니다. 내가 디버깅, 코드 줄을 사용하려고했습니다
expire_fragment(/songs/)
ActiveSupport::Cache::DalliStore does not support delete_matched
,하지만 무시되고 있어요 :
이 코드를 사용하려고 할 때이 오류를 받고 있어요.
before_filter only: [:songs]
expire_fragment(custom_cache_path)
end
저는 Rails 3.1.0.rc6, Dalli 1.0.5 및 Ruby 1.9.2를 사용하고 있습니다.
당신은이 보석과 함께 dallicache가있는 정규식을 사용합니다 : https://github.com/defconomicron/dalli-store-extensions –
감사합니다. – Oleander