Redis transaction can execute multiple commands at one time. It is essentially a set of commands. All commands in a transaction will be serialized and then executed serially in order without being inserted. Other commands.
1. What is a redis transaction?
Multiple commands can be executed at one time, which is essentially a set of commands. All commands in a transaction will be serialized and then executed serially in order without being inserted into other commands
2. What can Redis transactions do?
In a queue, a series of commands are executed in a certain, sequential and exclusive manner
3. How to use the redis command?
1. Transaction-related commands:
(1) DISCARD: cancel the transaction and give up executing all commands in the transaction block
(2) EXEC: execute Commands in the transaction block
(3) MULTI: Mark the start of a transaction
#
# 」
# key [key...]: Monitor one (or more) keys. If this (or these) keys are modified by other commands before executing the transaction, the transaction will be interrupted. 2. Transaction error reporting problem: (1) Statement error: An error will be reported directly when adding the queue. If this error occurs, the entire transaction will be rolled back (2) Logic error: For example, if a string 1 is given, an error will be reported during execution. This kind of error will not affect other operations in the transaction. Only this article will report an error
3. Watch monitoring:
Four and three features
1. Separate isolation operation: All commands in the transaction will be serialized and executed in order. During transaction execution, it will not be interrupted by command requests sent by other clients. 2. There is no concept of isolation level: The commands in the queue will not be actually executed before they are submitted, because no instructions will be actually executed before the transaction is submitted, so there is no There is a problem that "queries within a transaction must see physical updates, but queries outside the transaction cannot see this problem" 3. Atomicity is not guaranteed: If redis in the same transaction If one command fails to execute, subsequent commands will still be executed without rollback. (Unless an error occurs when joining the queue, that is, a compile-time exception similar to Java and an execution-time exception. Compilation will cause rollback, and execution-time exception will not roll back)Recommended tutorial : "Redis Tutorial
" ###The above is the detailed content of What is a Redis transaction. For more information, please follow other related articles on the PHP Chinese website!