Sha256: 22f4ed40a2f0a930acc7227741a4d3f147e2539873bc50221cd6a24e046dd73e

Contents?: true

Size: 474 Bytes

Versions: 5

Compression:

Stored size: 474 Bytes

Contents

module Typhoeus
  class Request
    module Cacheable
      def response=(response)
        Typhoeus::Config.cache.set(self, response) if cacheable?
        super
      end

      def cacheable?
        Typhoeus::Config.cache
      end

      def run
        if cacheable? && response = Typhoeus::Config.cache.get(self)
          finish(response)
        else
          super
        end
      end

      def cache_ttl
        options[:cache_ttl]
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
typhoeus-0.6.6 lib/typhoeus/request/cacheable.rb
typhoeus-0.6.5 lib/typhoeus/request/cacheable.rb
typhoeus-0.6.4 lib/typhoeus/request/cacheable.rb
typhoeus-0.6.3 lib/typhoeus/request/cacheable.rb
typhoeus-0.6.2 lib/typhoeus/request/cacheable.rb