Redis Summary 4

Source: Internet
Author: User


Multi

Set Sniper 1
Set//Command syntax error

All commands within the EXEC//transaction are not executed

Multi

Set Sniper 1
Lpush Sniper 3 Run-time exception,
Set Sniper2 3

At the end of the exec transaction, the first and third rows of the command execute, and the second row fails


Step A, compare, window one:
Watch Sniper
Multi
Set Sniper 3

Step B, window two: Set Sniper 6

Step c, window one: Exec end transaction

Step d, window one or window two: Get Sniper, value is 6

Conclusion: When you watch a variable, if the variable is changed in the transaction but the transaction does not end, at this point the variable is changed in the other place outside the transaction, then the variable change within the transaction will not work.

Watch command
Function: monitoring one or more keys, when the monitored key value is modified to block after the execution of a transaction.
However, there is no guarantee that other clients will not modify this key value, so we need to re-execute the command in the transaction after the failure of the transaction execution.
Note: After executing the EXEC command for a transaction, watch cancels the monitoring of all key values
Unwatch: Canceling monitoring


Redis Summary 4

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.