Redis
配置相关
Redis的启动不是Daemon,所以在服务器上需要设置一下: http://stackoverflow.com/questions/14816892/how-to-keep-redis-server-running
# By default Redis does not run as a daemon. Use ‘yes’ if you need it.
$ vi ./redis.conf 启动:$ ./redis-server /usr/local/src/redis-2.8.16/redis.conf
Most used Redis Commands
SET 'abc' 'def'
GET 'abc'
TYPE key1 # Result can be string, hash, list
hgetall 'a_hash_key'
hmget 'a_hash_key' id, status# id, status is the keys in the hash
hget 'a_hash_key' id# get only one key's value
## List
lrange 'something' 0 -1 # 显示所有
## Set
SMEMBERS 'something'
http://redis.io/commands/type
redis> SET key1 "value"
OK
redis> LPUSH key2 "value"
(integer) 1
redis> SADD key3 "value"
(integer) 1
redis> TYPE key1
string
redis> TYPE key2
list
redis> TYPE key3
set
redis>
client
$ redis-cli client list | grep 172.42.1.39 # 查看在172.42.1.39这台机器上的client的情况, 返回的age单位是秒.