Class: Net::HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/supercache/super_http_cache.rb

Instance Method Summary collapse

Instance Method Details

#request_with_superhttpcache(*args, &block) ⇒ Object Also known as: request



3
4
5
6
7
8
9
10
11
# File 'lib/supercache/super_http_cache.rb', line 3

def request_with_superhttpcache(*args, &block)
  if Rails.cache.read(:http_supercache)
    Rails.cache.fetch(Digest::SHA1.hexdigest(args[0].path.to_s + args[0].body.to_s)) do
      request_without_superhttpcache(*args, &block)
    end
  else
    request_without_superhttpcache(*args, &block)
  end
end