module Typhoeus::Request::Cacheable

Public Instance Methods

cache_ttl() click to toggle source
# File lib/typhoeus/request/cacheable.rb, line 22
def cache_ttl
  options[:cache_ttl]
end
cacheable?() click to toggle source
# File lib/typhoeus/request/cacheable.rb, line 9
def cacheable?
  cache
end
response=(response) click to toggle source
Calls superclass method
# File lib/typhoeus/request/cacheable.rb, line 4
def response=(response)
  cache.set(self, response) if cacheable? && !response.cached?
  super
end
run() click to toggle source
Calls superclass method
# File lib/typhoeus/request/cacheable.rb, line 13
def run
  if cacheable? && response = cache.get(self)
    response.cached = true
    finish(response)
  else
    super
  end
end

Private Instance Methods

cache() click to toggle source
# File lib/typhoeus/request/cacheable.rb, line 28
def cache
  return nil if options[:cache] === false
  options[:cache] || Typhoeus::Config.cache
end