0.0
No commit activity in last 3 years
No release in over 3 years
EventMachine based Redis client
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0

Runtime

 Project Readme

Redis Lite

Eventmachine based adapter that talks redis 2.0 protocol

Installation

gem install em-redislite

Dependencies

  • Ruby >= 1.9.1
  • eventmachine
  • em-synchrony (optional)

Unsupported commands

  • Pub/Sub
  • Scripting
  • Server

Example

Using callbacks

  require 'em-redislite'

  EM.run do
    # defaults to { host: '127.0.0.1', port: 6379 }
    client = EM::Redis.connect
    client.errback {|error| $stderr.puts "Redis Error: #{error}"; EM.stop }

    r = client.set "mykey", "myvalue"
    r.callback {|value| p value }
    r.errback  {|error| p error }

    r = client.get "mykey"
    r.callback {|value| p value }
    r.errback  {|error| p error }
  end

Using em-synchrony

  require 'em-redislite'
  require 'em-synchrony/em-redislite'

  EM.run do
    EM.synchrony do
      client = EM::Redis.connect
      client.errback {|error| $stderr.puts "Redis Error: #{error}"; EM.stop }
      
       p client.set "mykey", "myvalue"
       p client.get "mykey"
       EM.stop
    end
  end

License

Creative Commons Attribution - CC BY