您当前的位置: 首页 > 慢生活 > 程序人生 网站首页程序人生
redis-sort命令limit的使用
发布时间:2021-12-26 16:09:37编辑:雪饮阅读()
使用LIMIT限制返回结果
LIMIT主要是针对排序之后返回的结果进行限制,类似于mysql中的limit offset,count,这里也是跳过limit个选择count个。
實例如:
127.0.0.1:6379> mset test_1 1 test_2 2 test_3 3 test_4 4 test_5 5 test_6 6 test_7 7 test_8 8 test_9 9 test_10 10
OK
127.0.0.1:6379> sort skey by test_*
1) "1"
2) "2"
3) "3"
4) "4"
5) "5"
6) "6"
7) "7"
8) "8"
9) "9"
10) "10"
跳過3個選擇兩個
127.0.0.1:6379> sort skey by test_* limit 3 2
1) "4"
2) "5"
关键字词:redis,sort,limit