dushaoshuai / dushaoshuai.github.io

0 stars 0 forks source link

Redis: 原子命令 #121

Open dushaoshuai opened 1 year ago

dushaoshuai commented 1 year ago

GETSET MSET LMOVE

INCR https://redis.io/docs/data-types/strings/#:~:text=that%20INCR%20is-,atomic,-%3F%20That%20even%20multiple What does it mean that INCR is atomic? That even multiple clients issuing INCR against the same key will never enter into a race condition. For instance, it will never happen that client 1 reads "10", client 2 reads "10" at the same time, both increment to 11, and set the new value to 11. The final value will always be 12 and the read-increment-set operation is performed while all the other clients are not executing a command at the same time.

事务也可以认为是原子的,但是不支持在发生错误时回滚。 脚本也是事务性的。