https://github.com/redis-store/redis-sinatra
Redis stores for Sinatra
https://github.com/redis-store/redis-sinatra
Last synced: 12 months ago
JSON representation
Redis stores for Sinatra
- Host: GitHub
- URL: https://github.com/redis-store/redis-sinatra
- Owner: redis-store
- License: mit
- Created: 2011-09-08T07:20:22.000Z (almost 15 years ago)
- Default Branch: master
- Last Pushed: 2025-06-24T13:38:17.000Z (about 1 year ago)
- Last Synced: 2025-06-24T14:42:38.168Z (about 1 year ago)
- Language: Ruby
- Homepage: http://redis-store.org/redis-sinatra
- Size: 31.3 KB
- Stars: 29
- Watchers: 6
- Forks: 8
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: MIT-LICENSE
- Codeowners: CODEOWNERS
Awesome Lists containing this project
- awesome-sinatra - redis-sinatra - Redis stores for Sinatra. (NoSQL)
README
# Redis stores for Sinatra
__`redis-sinatra`__ provides a Redis backed cache store for __Sinatra__. See the main [redis-store readme](https://github.com/redis-store/redis-store) for general guidelines.
## Installation
```ruby
# Gemfile
gem 'redis-sinatra'
```
## Usage
```ruby
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.
## Running tests
```ruby
gem install bundler
git clone git://github.com/redis-store/redis-sinatra.git
cd redis-sinatra
bundle install
bundle exec rake
```
If you are on **Snow Leopard** you have to run `env ARCHFLAGS="-arch x86_64" bundle exec rake`
## Status
[](http://badge.fury.io/rb/redis-sinatra)
[](http://travis-ci.org/redis-store/redis-sinatra?branch=master)
[](https://codeclimate.com/github/redis-store/redis-sinatra)
## Copyright
2009 - 2013 Luca Guidi - [http://lucaguidi.com](http://lucaguidi.com), released under the MIT license