1. 程式人生 > >Redis命令、基礎資料型別

Redis命令、基礎資料型別

./redis-cli -p 6379 -a 1234
keys *
set name leon
get name
set age 29
get age
 quit
ps -ef|grep 6379
./redis-cli -p 6379 -a 1234 shutdown
./redis-server redis.conf 
/usr/local/redis/etc
265 dir /usr/local/redis/etc
del name
setnx name 11
setnx age 20
setex color 10 red
set email [email protected]
setrange email 5 ww
mset k1 11 k2 22 k4 44
mget k1 k2 k4 name age
getset key4 cc
clear
 incr age
decr age
incrby age 2
incrby age -2
 append name 1234
strlen name
hset user id 1
hset user name zs
hset user age 20
hset user sex man
hget user name
hget user age
hget user id
 hget user sex
hmset user id 4 name lisi age 20
hmget user id name sex  age
hexists user age
hlen user
hkeys user
hvals user
hgetall user
flushdb
 lpush list1 hello
lpush list1 world
lrange list1 0 -1
rpush list2 hello
rpush list2 world
lrange list2 0 -1
rpush list4 b
rpush list4 jing
rpush list4 b
rpush list4 jing
lrange list4 0 -1
lrem list4 1 "jing"
lrange list4 0 -1
lrem list4 1 "b"
 lrange 0 -1
lrange list2 0 -1
rpush list2 aa
lrange list2 0 -1
lpop list2
sadd set1 aa
sadd set1 bb
sadd set1 cc
smembers set1
sadd set1 bb
scard set1
zadd zset1 6 six
zadd zset1 3 three
zadd zset1 5 five
zadd zset1 4 four
zadd zset1 1 one
zadd zset1 2 two
zrange zset1 0 -1
zrange zset1 0 -1 withscores