Files
news.gitea.happylizard.me/bin/gems/typhoeus-1.4.1/lib/typhoeus/request/cacheable.rb
T
pizza2d1 4cee170d66
Gitea Actions Demo / Explore-Gitea-Actions (push) Failing after 9s
Add bin and edit workflow
2026-09-16 13:11:16 -06:00

39 lines
678 B
Ruby

module Typhoeus
class Request
module Cacheable
def response=(response)
cache.set(self, response) if cacheable? && !response.cached?
super
end
def cacheable?
cache
end
def run
if response = cached_response
response.cached = true
finish(response)
else
super
end
end
def cached_response
cacheable? && cache.get(self)
end
def cache_ttl
options[:cache_ttl]
end
private
def cache
return nil if options[:cache] === false
options[:cache] || Typhoeus::Config.cache
end
end
end
end