Redix LogoDocumentation
API ReferenceSorted Sets

ZIncrBy

Increment the score of a member in a sorted set

Syntax

Redix.ZIncrBy(key, increment, member, callback)

Parameters

Prop

Type

Returns

  • string: The new score as a string

Examples

-- Increment player kills
Redix.ZIncrBy('leaderboard:kills', 1, 'PlayerA', function(err, newScore)
    if not err then
        print('New kill count:', tonumber(newScore))
    end
end)

-- Decrement with negative value
Redix.ZIncrBy('leaderboard:deaths', -1, 'PlayerA')

-- Add points
Redix.ZIncrBy('leaderboard:points', 100, 'PlayerA')