API Cache

APICache allows any API client library to be easily wrapped with a robust caching layer. It supports caching (obviously), serving stale data and limits on the number of API calls. It’s also got a handy syntax if all you want to do is cache a bothersome url.

Install

$ sudo gem install api_cache -s http://gemcutter.org

Quick intro

This is how you access the twitter public timeline if you need your site to stay up, regardless of what twitter does.

It will fetch a new version once the cached version is 10 minutes old, keep the old version for a day just in case, and never contact twitter more than once a minute. Of course all these numbers are configurable.