Matthias
Matthias

Reputation: 647

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!

Upvotes: 5

Views: 1131

Answers (1)

Sripathi Krishnan
Sripathi Krishnan

Reputation: 31538

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.

Upvotes: 11

Related Questions