Get the App
SLTechnology News&Howtos  ›  Database  › 

What is the principle of implementing transactions with redis?

Shulou Source: shulou.com Published: 2022-06-01 01:54:59 10月04日 Update

This article mainly introduces the principle of redis to achieve transactions, the article is very detailed, has a certain reference value, interested friends must read it!

Atomicity: a transaction is an indivisible minimum unit of work that either succeeds or fails.

Atomic operation means that one of your business logic must be inseparable. For example, if you transfer money to others, your account deducts money, and other people's account increases money, this business logic is atomic, and this operation is atomic operation, which either succeeds or fails.

Is redis atomic?

The execution of all individual commands in Redis is atomic.

The principle of realizing transaction by redis

1. Bulk operations are cached in queues before sending EXEC commands

two。 After receiving the EXEC command, enter the transaction execution, any command execution in the transaction fails, and the rest of the commands will not be executed.

3. During transaction execution, command requests submitted by other clients are not inserted into the transaction execution command sequence

The above is all the content of what is the principle of redis transaction. Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Tags: Transaction command atom or principle success business content that is account logic minimum indivisible value interest single unit backward customer client Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Microsoft Huawei MariaDB Xiaomi