0.0
No commit activity in last 3 years
No release in over 3 years
An unified redis interface for redis-rb and em-redis.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 1.0.0.beta
 Project Readme

UnifiedRedis

An unified redis interface for redis-rb and em-redis.

Work in progress

Why ?

If you have some library which is used by both asynchronous and synchronous code, you probably want the same API.

For example, we have a stats module in production. We increment values inside a code running with EventMachine, but we expose data with a sinatra frontend.

The common denominator between asynchronous and synchronous is blocks. UnifiedRedis allows you to use the same API with either redis-rb or em-redis.

Install

Install with Rubygems:

gem install unified-redis

If you use bundler, add it to your Gemfile:

gem "unified-redis", "~> 0.0.1"

Usage

If you want to use redis-rb:

require 'unified-redis'

unified = UnifiedRedis.new(Redis.new)
unified.get("chuck") do |response|
    puts response
end

The same API is available with em-redis:

require 'unified-redis'

EM.run do
  unified = UnifiedRedis.new(EM::Protocols::Redis.connect)
  unified.get("chuck") do |response|
    puts response
  end
end

TODO

  • compatibility with redis-namespace

Tests

bundle install
rake

License

MIT License

Copyright (C) 2011 by af83