Home > helloredis

helloredis

Helloredis is a project mainly written in Ruby, it's free.

An incomplete Ruby FFI interface to hiredis for educational purposes.

This is an incomplete, experimental Ruby FFI interface to Hiredis.

It exists mainly as a tool to teach me about Ruby's FFI interface and, as such, the location of the libhiredis library is hard-coded into hiredis.rb as being /usr/local/lib. If you want to tinker with this yourself, make sure to amend that path as necessary.

Prerequisites

  • Hiredis 0.9.2 installed to /usr/local/lib.

Usage

# With the project's lib directory on your load path...
require "helloredis"

redis = Helloredis.new # defaults to connecting to 127.0.0.1:6379
redis.set("foo", "bar")
# => "OK"
redis.get("foo")
# => "bar"
redis.lpush("mylist", "arnold")
# => 1
redis.lpush("mylist", "bob")
# => 2
redis.sort("mylist", :alpha => true, :order => :desc, :count => 1, :offset => 0)
# => ["bob"]

See spec/helloredis_spec.rb for more usage information.

Previous:first_app