Redix LogoDocumentation
API ReferenceHashes

HIncrementBy

Atomically increment an integer field in a hash

Syntax

Redix.HIncrementBy(key, field, amount, callback)

Parameters

Prop

Type

Returns

Prop

Type

Examples

-- Increment player kills
Redix.HIncrementBy('player:123:stats', 'kills', 1, function(err, newKills)
    if not err then
        print('New kill count:', newKills)
    end
end)

-- Decrement using negative value
Redix.HIncrementBy('player:123:stats', 'lives', -1)