Created
February 24, 2011 23:22
-
-
Save tobyhede/843114 to your computer and use it in GitHub Desktop.
Redis samples commands from Melbourne February Ruby on Rails meetup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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