Coder Social home page Coder Social logo

unified-redis's Introduction

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

unified-redis's People

Contributors

francois2metz avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.