Module: Typhoeus::Request::Cacheable
- Included in:
- Typhoeus::Request
- Defined in:
- lib/typhoeus/request/cacheable.rb
Overview
Instance Method Summary collapse
Instance Method Details
#cache_ttl ⇒ Object
22 23 24 |
# File 'lib/typhoeus/request/cacheable.rb', line 22 def cache_ttl [:cache_ttl] end |
#cacheable? ⇒ Boolean
9 10 11 |
# File 'lib/typhoeus/request/cacheable.rb', line 9 def cacheable? cache end |
#response=(response) ⇒ Object
4 5 6 7 |
# File 'lib/typhoeus/request/cacheable.rb', line 4 def response=(response) cache.set(self, response) if cacheable? && !response.cached? super end |
#run ⇒ Object
13 14 15 16 17 18 19 20 |
# 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 |