atan
V2EX  ›  Redis

如何修改sorted set中的score值

  •  
  •   atan ·
    tanshiqi · Nov 9, 2012 · 8797 views
    This topic created in 4937 days ago, the information mentioned may be changed or developed.
    刚开始看redis,有个疑问,sorted set支持score的排序,但是如何修改已有元素的score值?
    4 replies    1970-01-01 08:00:00 +08:00
    KiseXu
        1
    KiseXu  
       Nov 10, 2012   ❤️ 1
    ZINCRBY key increment member
    为有序集 key 的成员 member 的 score 值加上增量 increment
    (其中increment值可以为负,这样就可以实现减去score值)

    楼主,多看看手册啊,这些官方手册上都有的
    luin
        2
    luin  
       Nov 10, 2012
    使用zadd
    atan
        3
    atan  
    OP
       Nov 10, 2012
    @luin 是的,zadd可以覆盖score,谢谢 @KiseXu 是该多看看手册:)
    KiseXu
        4
    KiseXu  
       Nov 10, 2012
    @atan :)
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3851 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 36ms · UTC 04:28 · PVG 12:28 · LAX 21:28 · JFK 00:28
    ♥ Do have faith in what you're doing.