HTML tutorial
CSS3 tutorial
Bootstrap tutorial
JavaScript tutorial
JQuery tutorial
AngularJS tutorial
React tutorial
NodeJS tutorial
PHP tutorial
Python tutorial
Python3 tutorial
Django tutorial
Linux tutorial
Docker tutorial
Ruby tutorial
Java tutorial
C tutorial
C ++ tutorial
Perl tutorial
JSP tutorial
Lua tutorial
Scala tutorial
Go tutorial
ASP.NET tutorial
C # tutorial
Redis transaction execute multiple commands at once, and with two important guarantees:
A transaction from start to execution through the following three stages:
The following is an example of a transaction, it first started a business withMULTI, then multiple commands into teams to the transaction, triggered by last EXECcommand transaction, together with all the commands in a transaction:
redis 127.0.0.1:6379> MULTI OK redis 127.0.0.1:6379> SET book-name "Mastering C++ in 21 days" QUEUED redis 127.0.0.1:6379> GET book-name QUEUED redis 127.0.0.1:6379> SADD tag "C++" "Programming" "Mastering Series" QUEUED redis 127.0.0.1:6379> SMEMBERS tag QUEUED redis 127.0.0.1:6379> EXEC 1) OK 2) "Mastering C++ in 21 days" 3) (integer) 3 4) 1) "Mastering Series" 2) "C++" 3) "Programming"
The following table lists the commands for redis matters:
No. | Command and description |
---|---|
1 | DISCARD Cancel the transaction, give up all the commands within a transaction block. |
2 | EXEC Run all transactions within the block. |
3 | MULTI It marks the start of a transaction block. |
4 | UNWATCH Cancel WATCH command to monitor all of the key. |
5 | WATCH key [key /en.] Monitor one (or more) key, if this (or these) key was altered other commands before the transaction is executed, the transaction will be interrupted. |