Is the Redis command installed by atomic operation?

I am trying to use the Redis command setto implement the simplest distributed locking component, but I cannot find any exact basis for atomicity through the white paper, is the Redis command an SET key value [EX seconds] [PX milliseconds] [NX|XX]atomic operation?

+4
source share
1 answer

Yes. The kernel is single-threaded, so nothing will be executed until SETit finishes; making SET {key} {value} EX {expiry} NXideal for easy locking.

+8
source

Source: https://habr.com/ru/post/1674222/


All Articles