Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Redis is ZINCRBY atomic?

I am building a leaderboard implementation using redis.

My question is if ZINCRBY is an atomic actions an can be used without a separate mutex or something in a multithreaded environment?

the documentation of ZINCRBY does not mention anything about atomic implemtnation as the documentation of INCR does for INCR, INCRBY and DECR

thanks a lot!

like image 854
Matthias Avatar asked Aug 30 '12 13:08

Matthias


1 Answers

Yes, ZINCRBY is atomic. There is no need for external synchronization.

Redis is effectively single threaded. Even if two threads send commands to Redis concurrently, Redis will only execute them in a serial order.

like image 109
Sripathi Krishnan Avatar answered Sep 27 '22 22:09

Sripathi Krishnan