redis学习(5) - 有序集合类型

时间:2021-10-30 17:00:08

命令:

ZADD:

    ZADD key score member [score member ...]   增加元素(score:整数|浮点数)

    如:ZADD scoreboard 89 tom 67 peter 100 david

ZSCORE:

    ZSCORE key member   获得元素的分数  如:ZSCORE scoreboard tom

ZRANGE:(分数从小到大)

    ZRANGE key start stop [WITHSCORES]  获得排名在某个索引范围的元素列表

ZREVRANGE:(分数从大到小)

    ZREVRANGE key start stop [WITHSCORES]  

ZRANGEBYSCORE:(分数从小到大)

    ZRANGEBYSCORE key min max [WITHSCORES] [LIMIT offset count]  获得指定分数范围的元素

ZREVRANGEBYSCORE:

    ZREVRANGESCORE key min max [WITHSCORES] [LIMIT offset count]  获得指定分数范围的元素

ZINCRBY:

    ZINCRBY key increment member  增加某个元素的分数

ZCARD:

    ZCARD keey   获得集合中元素的数量

ZCOUNT:

    ZCOUNT key min max  获得指定分数范围内的元素个数

ZREM:

    ZREM key member [member ...]  删除一个或多个元素

ZREMRANGEBYRANK:

    ZRENRANGEBYRANK key start stop   按照排名索引范围删除元素

ZREMRANGEBYSCORE:

    ZREMRANGEBYSCORE key min max  按照分数范围删除元素

ZRANK:

    ZRANK key member  获得元素的排名(分数从小到大,从0开始)  

ZREVRANK:

    ZREVRANK key member  获得元素的排名(分数从大到小,从0开始)


本文出自 “redis学习一” 博客,请务必保留此出处http://6993984.blog.51cto.com/6983984/1611349