• Tyson Andre's avatar
    Add a ZMSCORE command returning an array of scores. (#7593) · f11f26cc
    Tyson Andre authored
    
    
    Syntax: `ZMSCORE KEY MEMBER [MEMBER ...]`
    
    This is an extension of #2359
    amended by Tyson Andre to work with the changed unstable API,
    add more tests, and consistently return an array.
    
    - It seemed as if it would be more likely to get reviewed
      after updating the implementation.
    
    Currently, multi commands or lua scripting to call zscore multiple times
    would almost definitely be less efficient than a native ZMSCORE
    for the following reasons:
    
    - Need to fetch the set from the string every time instead of reusing the C
      pointer.
    - Using pipelining or multi-commands would result in more bytes sent by
      the client for the repeated `ZMSCORE KEY` sections.
    - Need to specially encode the data and decode it from the client
      for lua-based solutions.
    - The fastest solution I've seen for large sets(thousands or millions)
      involves lua and a variadic ZADD, then a ZINTERSECT, then a ZRANGE 0 -1,
      then UNLINK of a temporary set (or lua). This is still inefficient.
    Co-authored-by: default avatarTyson Andre <tysonandre775@hotmail.com>
    f11f26cc
cluster.tcl 11.8 KB