redis常用命令行的使用
官网命令行介绍:https://redis.io/commands/
redis命令手册:https://redis.com.cn/commands.html
# redis-cli 客户端命令行工具
连接本地:
```
redis-cli
```
连接远端:
```
redis-cli -h host -p port -a password
```
# 命令
```
redis默认有15 个库 标识分别是0-15
select 1
set key value
get key
dbsize 键值总数
检查key是否存在
exists key
删除
del key
设置过期时间
expire key seconds
获取key剩余过期时间 返回值-1说明没有设置过期时间, -2 则表示过期
ttl key
返回key数据类型
type key
```
这里只做简单介绍了,更多命令 [点击查看](https://redis.com.cn/commands.html)。

redis常用命令行