Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Caching for HTTParty

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 .gitignore
Octocat-spinner-32 Gemfile
Octocat-spinner-32 History
Octocat-spinner-32 LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 httparty-icebox.gemspec
README.md

HTTParty-Icebox - Caching for HTTParty

Description

Cache responses in HTTParty models

Installation

RubyGems

You can install the latest Film Buff gem using RubyGems

gem install httparty-icebox

GitHub

Alternatively you can check out the latest code directly from Github

git clone http://github.com/sachse/httparty-icebox.git

Usage

Examples

Enable caching with default values:

require 'httparty-icebox'

include HTTParty::Icebox

cache
# Use HTTParty's .get method as usual, the response will now be cached
cached_response = HTTParty.get("https://github.com/sachse/httparty-icebox")

Cache responses for 5 minutes on the system in the directory "/tmp":

require 'httparty-icebox'

include HTTParty::Icebox

cache :store => 'file', :timeout => 300, :location => '/tmp/'
# Use HTTParty's .get method as usual, the response will now be cached
cached_response = HTTParty.get("https://github.com/sachse/httparty-icebox")

Authors

Contribute

Fork the project, implement your changes in it's own branch, and send a pull request to me. I'll gladly consider any help or ideas.

Contributors

  • Martyn Loughran - Major parts of this code are based on the architecture of ApiCache.
  • David Heinemeier Hansson - Other parts are inspired by the ActiveSupport::Cache in Ruby On Rails.
  • Amit Chakradeo - For pointing out response objects have to be stored marshalled on FS.
  • Marlin Forbes - For pointing out the query parameters have to be included in the cache key.
  • ramieblatt - Original Memcached store.
Something went wrong with that request. Please try again.