Class: LHS::Interceptors::RequestCycleCache::Interceptor

Inherits:
LHC::Interceptor
  • Object
show all
Defined in:
lib/lhs/interceptors/request_cycle_cache/interceptor.rb

Constant Summary collapse

VERSION =
1
CACHED_METHODS =
[:get].freeze

Instance Method Summary collapse

Instance Method Details

#before_requestObject



15
16
17
18
19
20
21
22
23
24
25
# File 'lib/lhs/interceptors/request_cycle_cache/interceptor.rb', line 15

def before_request
  request.options = {
    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