Module: Typhoeus::Hydra::Cacheable

Included in:
Typhoeus::Hydra
Defined in:
lib/typhoeus/hydra/cacheable.rb

Overview

Since:

  • 0.5.0

Instance Method Summary collapse

Instance Method Details

#add(request) ⇒ Object

Since:

  • 0.5.0



4
5
6
7
8
9
10
11
12
# File 'lib/typhoeus/hydra/cacheable.rb', line 4

def add(request)
  if request.cacheable? && response = request.cached_response
    response.cached = true
    request.finish(response)
    dequeue
  else
    super
  end
end