覆盖在学习和工作中的常用 Redis 命令:Server / Client / Database / String / Hash / List / Set / Sorted Set
目录 Table of Contents
Server
1 2
| redis-server redis.conf
|
Client
1 2
| redis-cli -h ${host] -p ${post} -a ${password}
|
Database
Key
查询
1 2 3 4 5 6 7 8
| EXISTS ${key}
KEYS ${regexp}
GET ${key}
|
超时
1 2 3 4 5 6 7
| EXPIRE ${key} ${second} EXPIREAT ${key} ${timestamp} PEXPIRE ${key} ${millisecond}
PERSIST ${key}
|
String
查询
1 2 3 4 5 6 7 8
| EXISTS ${key}
KEYS ${regexp}
GET ${key}
|
设置
删除
Hash
查询
1 2 3 4 5 6 7 8 9 10 11
| HEXISTS ${key} ${h_key}
HGET ${key} ${h_key}
HMGET ${key} ${h_key}...
HGETALL ${key}
|
设置
1 2 3 4 5
| HSET ${key} ${h_key} ${h_value}
HMSET ${key} ${h_key} ${h_value} ...
|
删除
1 2 3 4 5
| DEL ${key} ${h_key}
DEL ${key} ${h_key}...
|
List
Set
Sorted Set