Skip to main content
Use ZINCRBY to add an increment to the score of a member of a sorted set. A member that is not there yet is created with the increment as its score, and a missing key is created too, so no initialization step is needed. The increment may be negative to move a member down. The reply is the new score. Because the update is atomic and the set stays ordered, this is the core operation behind leaderboards, vote counts, and any ranking that has to reflect concurrent updates: increment a member’s score and read the position back with ZRANK or the top of the ranking with ZRANGE.

Syntax

Arguments

Important points

  • RESP2 represents floating-point reply values as bulk strings; RESP3 may use native double replies. Client libraries commonly decode either form to a language number.

Response

The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.
Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.

Examples

TCP examples use the TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.

Related topics

ZINCRBYCostsZRANKZADD