77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
# File 'lib/fume/render_cache.rb', line 77
def filter(controller)
controller.render_cache_params ||= {
options: {},
cache: nil
}
controller.render_cache_params[:cache] = Rails.cache if controller.class.perform_caching
yield
params = controller.render_cache_params
if params[:key]
content = {
:charset => controller.response.charset,
:content_type => controller.response.content_type,
:body => controller.response_body.is_a?(Array) ? controller.response_body.join : controller.response_body
}
params[:cache].write(params[:key], content, params[:options])
end
end
|