Sha256: 84e24d488e98aa0d86d7e92f5d6cc4b7b13d34530eeb7e044b19c0c6b4728ccc

Contents?: true

Size: 1.4 KB

Versions: 1

Compression:

Stored size: 1.4 KB

Contents

# Redis stores for Sinatra

__`redis-sinatra`__ provides a Redis backed cache store for __Sinatra__. It natively supports object marshalling, timeouts, single or multiple nodes and namespaces.

## Redis Installation

### Option 1: Homebrew

MacOS X users should use [Homebrew](https://github.com/mxcl/homebrew) to install Redis:

    brew install redis

### Option 2: From Source

Download and install Redis from [http://redis.io](http://redis.io/)

	wget http://redis.googlecode.com/files/redis-2.4.15.tar.gz
    tar -zxf redis-2.4.15.tar.gz
    mv redis-2.4.15 redis
    cd redis
    make

## Usage

    # Gemfile
	gem 'redis-sinatra'

### Cache Store:

	require 'sinatra'
	require 'redis-sinatra'

	class MyApp < Sinatra::Base
	  register Sinatra::Cache
	  get "/hi" do
	    settings.cache.fetch("greet") { "Hello, World!" }
	  end
	end

Keep in mind that the above fetch will return `"OK"` on success, not the return of the block.

#### Configuration

For advanced configuration options, please check the [Redis Store Wiki](https://github.com/jodosha/redis-store/wiki).

## Running tests

    git clone git://github.com/jodosha/redis-store.git
	cd redis-store/redis-sinatra
	gem install bundler
	bundle exec rake

If you are on **Snow Leopard** you have to run `env ARCHFLAGS="-arch x86_64" bundle exec rake`

## Copyright

(c) 2009 - 2011 Luca Guidi - [http://lucaguidi.com](http://lucaguidi.com), released under the MIT license

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
redis-sinatra-1.3.3 README.md