Skip to content

Redis rb Overview

ipoval edited this page Aug 17, 2011 · 7 revisions

Ruby client library for redis

Start:

require "redis"
redis = Redis.new

Keys:

redis.set("redis_db", "great k / v storage") # => OK
redis.get("redis_db")                        # => "great k / v storage"

Counters:

redis.incr("redis_db")                       # => 1
redis.decr("couch_db")                       # => -1
redis.incrby("redis_db", 99)                 # => 100
redis.decrby("couch_db", -101)               # => 100

Expiration:

redis.expire("redis_db", 100)                # => true
Clone this wiki locally