Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is redis HINCRBY atomic?

Tags:

redis

I want to track inventory state. We are using redis currently in stack. At present we do this using Postgres. Whenever inventory is in we increment the count and whenever inventory is out we reduce the count. For efficiency purpose I want to try redis HIncrBy. Is this operation atomic? Are there any pitfalls I should be aware of?

like image 469
Marut Singh Avatar asked Mar 12 '23 10:03

Marut Singh


1 Answers

Since Redis is single-threaded, everything is atomic.

like image 182
sberry Avatar answered Mar 20 '23 19:03

sberry