Redis的原子性?什么是原子操作?
天蓬老师
天蓬老师 2017-04-25 09:04:06
0
3
929
  1. 什么是Redis的原子性?

  2. 什么叫做原子操作?

  3. 在 Redis 中什么样的操作算是原子操作?

天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(3)
Ty80
  1. The atomicity of Redis has two points:

    • A single operation is atomic

    • Multiple operations also support transactions, that is, atomicity, wrapped through MULTIEXEC instructions

  2. Atomic operation means that it will either be executed successfully or not executed at all if it fails. The most vivid metaphor is the real-life transfer metaphor. Your transfer either succeeds or fails. The money does not move. There is no such thing as your money being transferred out, but the payee did not receive it. This is a half-success and half-failure situation

  3. Point 1 has been answered

小葫芦

Atomicity: A transaction is an indivisible minimum unit of work, either all succeed or all fail.

Atomic operation means that one of your business logic must be indivisible. For example, if you transfer money to someone else, your account will deduct money, and someone else's account
will add money, this business logic is atomic, and this operation is an atomic operation. , either all succeed or both fail.

The execution of all single commands in Redis is atomic.

The principle of redis implementing transactions

1. 批量操作在发送 EXEC 命令前被放入队列缓存
2. 收到 EXEC 命令后进入事务执行,事务中任意命令执行失败,其余的命令都不会被执行
3. 在事务执行过程,其他客户端提交的命令请求不会插入到事务执行命令序列中
巴扎黑

I feel that atomicity means that only one operation can be performed at the same time. (A transaction is an indivisible minimum unit of work, either all succeed or all fail.) It should be about consistency. I’m a bit confused here

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!