Class: DHS::Interceptors::RequestCycleCache::Interceptor

Inherits:
DHC::Interceptor
  • Object
show all
Defined in:
lib/dhs/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/dhs/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: DHS.config.request_cycle_cache
    }
  }.merge(request.options)
end