zrange:索引的范围检索(withScores,递增)-->zrevrange(递减)
redis 127.0.0.1:6779> zadd ss 12 a
(integer) 0
redis 127.0.0.1:6779> zadd ss 5 b
(integer) 1
redis 127.0.0.1:6779> zadd ss 1000 c
(integer)
zrange
redis 127.0.0.1:6779> zrange ss 0 -1
1) "b"
2) "a"
3) "c"
zrange withscores
redis 127.0.0.1:6779> zrange ss 0 -1 withscores
1) "b"
2) "5"
3) "a"
4) "12"
5) "c"
6) "1000"
注意这里检索的范围是索引的值
redis 127.0.0.1:6779> zrange ss 0 1 withscores
1) "b"
2) "5"
3) "a"
4) "12"
zrangebyscore :score的范围来检索(这个时候需要知道score的范围)
redis 127.0.0.1:6779> zrangebyscore ss 100 1500 withscores
1) "c"
2) "1000"
redis 127.0.0.1:6779> zrangebyscore ss 12 1500 withscores
1) "a"
2) "12"
3) "c"
4) "1000"
redis 127.0.0.1:6779> zrangebyscore ss 1 15 withscores
1) "b"
2) "5"
3) "a"
4) "12"
zrevrank,返回成员的排名
redis 127.0.0.1:6779> zrange ss 0 -1 withscores
1) "b"
2) "5"
3) "a"
4) "12"
5) "c"
6) "1000"
redis 127.0.0.1:6779> zrevrank ss a
(integer) 1
zremrangebyscore 删除指定score的元素,zremrangebyrank删除指定排名区间的元素
redis 127.0.0.1:6779> zrange ss 0 -1 withscores
1) "b"
2) "5"
3) "a"
4) "12"
5) "c"
6) "1000"
redis 127.0.0.1:6779> aremr
(error) ERR unknown command ‘aremr‘
redis 127.0.0.1:6779> zremrangebyscore ss 1 12
(integer) 2
redis 127.0.0.1:6779> zrange ss 0 -1 withscores
1) "c"
2) "1000"
redis 127.0.0.1:6779>