Redis's (ix) transaction mechanism for Redis

Source: Internet
Author: User
Tags redis server
[A] What is a Redis transaction---a >redis transaction is a set of commands. --->redis transaction is to ensure that a set of commands is either executed or not executed. However, a set of commands is not supported, and one or more of the executions fail, and data rollback is not supported. Data consistency, which is controlled by the programmer. --->redis transactions can also ensure that commands within a transaction are executed sequentially, without being inserted by other commands. Imagine that client a sends several commands to the Redis server, and Client B also sends a command to the Redis server. If a transaction is not used, then the command for Client B is likely to be executed in the middle of the several commands of client A. [Two]redis transaction plain English---> Use multi to open a transaction and then send a set of commands. Use exec to execute this set of commands in turn. --->redis's business. There is a collector that accepts a set of commands from the client and executes them together. If the client is disconnected before the exec is sent, the set of commands is not executed. This is the business of Redis. Such as. [Error handling for three]redis transactions---> What Redis does if one of the commands in a transaction performs an error. After 2.65 versions. (1) The first type: command syntax error.  A syntax error is a command that does not have the wrong number of arguments for a live command. Processing: If there is a syntax error in a set of commands, none of the commands will be executed. Include those commands that are syntactically correct. (2) The second type: a run-time error is the error that occurs when the command executes.  For example: The hash type of the command, the operation of the collection type key. Processing: The correct command executes, the command that runs the error is not executed, and the data for the command that has been executed is not rolled back. Requires the programmer to implement the rollback in the code itself.

Redis's (ix) transaction mechanism for Redis

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.