16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/action_controller/caching/redis_pages.rb', line 16
def caches_redis_page(*actions)
return unless (RedisPage.cache_relation_redis && RedisPage.cache_page_redis)
options = actions.
before_filter({only: actions}.merge(options)) do |c|
@page_need_to_cache = true
if options[:append_country]
@cache_country = (cookies[:country] || request.['X-IP-Country']).try(:upcase)
end
end
after_filter({only: actions}.merge(options)) do |c|
path = [request.path, @cache_country, RedisPage.compress_method].compact.join('-')
c.cache_redis_page(compress_content(response.body), path, options)
c.record_cached_page
end
end
|