Skip to content

Instantly share code, notes, and snippets.

@tobyhede
Created February 24, 2011 23:22
Show Gist options
  • Save tobyhede/843114 to your computer and use it in GitHub Desktop.
Save tobyhede/843114 to your computer and use it in GitHub Desktop.
Redis samples commands from Melbourne February Ruby on Rails meetup
Redis
================
brew install redis
To start redis manually:
redis-server /usr/local/etc/redis.conf
To access the server:
redis-cli
See what's happening on the server:
redis-cli > monitor
String
----------------
set mindtrick "These are not the droids you’re looking for"
get mindtrick
List
----------------
rpush droids "C3PO"
rpush droids "R2D2
rpush droids "IT-O Interrogator"
lrange droids 0 2
Magics
----------------
incr next.philosopher.id
set philosopher:1:name "Jean-Paul Sartre"
set philosopher:1:genre "Existentialism"
lpush philosophers 1
lrange philosophers 0 1
Set
-----------------
sadd fibonacci 1
sadd fibonacci 1
sadd fibonacci 2
sadd fibonacci 3
smembers fibonacci
sismember fibonacci 1
SORT fibonacci ASC
Sorted Set
-----------------
zadd planets 1 "Mercury"
zadd planets 2 "Venus"
zadd planets 3 "Earth"
zadd planets 4 "Mars"
zrange planets 0 -1
zrevrange planets 0 -1
SORT planets ALPHA
SORT planets ALPHA DESC
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment