Sha256: 44d147a3b896547280b4329d2184d8952286af86f2288bcca53527c6f1fc50f6
Contents?: true
Size: 955 Bytes
Versions: 31
Compression:
Stored size: 955 Bytes
Contents
require 'active_support' class LHS::Record module RequestCycleCache extend ActiveSupport::Concern class Interceptor < LHC::Interceptor VERSION = 1 CACHED_METHODS = [:get].freeze def before_request request.options = request.options.merge({ cache: { expires_in: 5.minutes, race_condition_ttl: 5.seconds, key: cache_key_for(request), methods: CACHED_METHODS, use: LHS.config.request_cycle_cache } }.merge(request.options)) end private def cache_key_for(request) [ "LHS_REQUEST_CYCLE_CACHE(v#{VERSION})", request.method.upcase, [request.url, request.params.presence].compact.join('?'), "REQUEST=#{LHS::Record::RequestCycleCache::RequestCycleThreadRegistry.request_id}", "HEADERS=#{request.headers.hash}" ].join(' ') end end end end
Version data entries
31 entries across 31 versions & 1 rubygems