Search code examples
redismutexatomic

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!


Solution

  • 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.