redis-sinatra provides a Redis backed cache store for Sinatra. See the main redis-store readme for general guidelines.
# Gemfile
gem 'redis-sinatra'require 'sinatra'
require 'redis-sinatra'
class MyApp < Sinatra::Base
register Sinatra::Cache
get '/hi' do
settings.cache.fetch('greet') { 'Hello, World!' }
end
endKeep in mind that the above fetch will return "OK" on success, not the return of the block.
gem install bundler
git clone git://github.com/redis-store/redis-sinatra.git
cd redis-sinatra
bundle install
bundle exec rakeIf you are on Snow Leopard you have to run env ARCHFLAGS="-arch x86_64" bundle exec rake
2009 - 2013 Luca Guidi - http://lucaguidi.com, released under the MIT license


