zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

Redis查询Key

Redis 查询 Key
2023-09-11 14:17:05 时间

Redis查询Key
2017年08月15日 11:42:35 阅读数:2177 标签: redis 更多
个人分类: 脚本语言
http://www.redis.net.cn/order/3535.html
Redis命令:http://www.redis.net.cn/order/
Redis Keys 命令用于查找所有符合给定模式 pattern 的 key 。。
语法
redis KEYS 命令基本语法如下:
redis 127.0.0.1:6379> KEYS PATTERN
可用版本
>= 1.0.0
返回值
符合给定模式的 key 列表 (Array)。
实例
首先创建一些 key,并赋上对应值:
redis 127.0.0.1:6379> SET w3c1 redis
OK
redis 127.0.0.1:6379> SET w3c2 mysql
OK
redis 127.0.0.1:6379> SET w3c3 mongodb
OK
查找以 w3c 为开头的 key:
redis 127.0.0.1:6379> KEYS w3c*
1) "w3c3"
2) "w3c1"
3) "w3c2"
获取 redis 中所有的 key 可用使用 *。
redis 127.0.0.1:6379> KEYS *
1) "w3c3"
2) "w3c1"
3) "w3c2"