V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
atan
V2EX  ›  Redis

如何修改sorted set中的score值

  •  
  •   atan ·
    tanshiqi · Nov 9, 2012 · 8778 views
    This topic created in 4930 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   ·   869 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 21:37 · PVG 05:37 · LAX 14:37 · JFK 17:37
    ♥ Do have faith in what you're doing.