Works with Rack::Cache to serve up stale data while silently revalidating
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
README.rdoc
Rakefile
VERSION.yml
rack-revalidate-while-cache.gemspec

README.rdoc

Rack::CacheWhileRevalidate

Idea

Often, for caching, you don't care if the data is a little stale, you're content to serve the stale data and silently revalidate the cache in the background.

Usage

In your builder (or rackup or whatever), make sure you first off: use Rack::Capabilities

Then, wherever your Rack::Cache usage occurs, put use Rack::CacheWhileRevalidate directly before it (NB). That's it!