Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

An incomplete Ruby FFI interface to hiredis for educational purposes.

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .rspec
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 README.md
Octocat-spinner-32 helloredis.gemspec
README.md

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.

Something went wrong with that request. Please try again.