I would like to reset the value of a REDIS counter to 0 in a Rails 4 app.
I use hincrby to increment counters
$redis.hincrby("user:likes", "key", 1)
I can't delete the key with hdel http://redis.io/commands/hdel because I need to get the key often.
GETSET is atomic and could do the job http://redis.io/commands/getset, as in the example
GETSET mycounter "0"
But since I use hashes I need to use HSET http://redis.io/commands/hset
$redis.hset("user:likes", "key", "0")
It's not specified if hset is atomic, anyone used hset to reset redis counters to 0? If it's not a good option to reset a counter to 0, any idea how to do it?