An unified redis interface for
Work in progress
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
Install with Rubygems:
gem install unified-redis
If you use bundler, add it to your Gemfile:
gem "unified-redis", "~> 0.0.1"
If you want to use
require 'unified-redis' unified = UnifiedRedis.new(Redis.new) unified.get("chuck") do |response| puts response end
The same API is available with
require 'unified-redis' EM.run do unified = UnifiedRedis.new(EM::Protocols::Redis.connect) unified.get("chuck") do |response| puts response end end
- compatibility with redis-namespace
bundle install rake
Copyright (C) 2011 by af83