redis ZINCRBY command


  Translation results:

incr

increase increase; increase increase; increase increase; increase increase

by

英[ baɪ] 美[baɪ]

prep.beside...;expression method;due to;passing through

adv.passing;expressing retention or preservation; short visit

redis ZINCRBY commandsyntax

Function: Add increment to the score value of the member of the ordered set key.

Syntax: ZINCRBY key increment member

Instructions: You can pass a negative value increment to subtract the corresponding value from score, such as ZINCRBY key -5 member means subtracting 5 from the score value of member. When key does not exist, or member is not a member of key, ZINCRBY key increment member is equivalent to ZADD key increment member. When key is not an ordered set type, an error is returned. The score value can be an integer value or a double precision floating point number.

Available versions: >= 1.2.0

Time complexity: O(log(N))

Return: member The new score value of the member, expressed in string form.

redis ZINCRBY commandexample

redis> ZSCORE salary tom
"2000"
redis> ZINCRBY salary 2000 tom   # tom 加薪啦!
"4000"

Home

Videos

Q&A