Is the simple implementation of locking for a single instance of redis reliable?

for example, iphone rewards are given if the judgment key does not exist, and the key is set immediately after the code is entered, so that multiple users will not all get the prize. I wonder whether the concurrency is high enough or there is a probability that multiple user judgment keys do not exist at the same time, so that a lot of prizes will be issued.

Apr.28,2021

No, redis is single-threaded. The operations of multithreaded programs do not exist concurrency in redis . Once you have the winning key, other threads will access it again.


depends on what command you use, you will definitely use get, and you will not use the setnx command

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3722f-2c07a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3722f-2c07a.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?