Skip to content

Instantly share code, notes, and snippets.

@hanshasselberg
Created February 13, 2013 12:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hanshasselberg/4944429 to your computer and use it in GitHub Desktop.
Save hanshasselberg/4944429 to your computer and use it in GitHub Desktop.
require "rubygems"
require "bundler/setup"
require 'typhoeus'
class Cache
attr_reader :memory
def initialize
@memory = {}
end
def get(request)
memory[request]
end
def set(request, response)
memory[request] = response
end
end
c = Cache.new
Typhoeus::Config.cache = c
puts Typhoeus.get("127.0.0.1:3001").inspect
puts Typhoeus.get("127.0.0.1:3001/wp-content/plugins").inspect
source "http://rubygems.org"
gem 'typhoeus', :git => "https://github.com/typhoeus/typhoeus.git"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment