Redis features_multi-database, transaction

One, multiple databases

1. Multiple databases
  • A redis instance has up to 16 databases, subscript 0-15

  • You can select the database through the select subscript

  • Connect to database 0 by default

2. Move a key to another database
  •   move key名 数据库下标		例如:move string1 1 将string1key移到1号数据库
    

Two, Redis transaction

  • (1) Redis executes the transaction. During the transaction, all commands will be serialized and executed sequentially. During the execution, redis will not provide services to other clients, thus ensuring that all commands of the transaction are executed atomically
  • (2) Before the transaction is executed, it is down and disconnected from the server, and the transaction operation will not be executed
  • (3) After the transaction is executed, it is down and disconnected from the server, and the transaction operation will take effect

1. Business process

  • Commands executed after multi are considered transaction operations

  • exec executes the transaction

  • Roll back after a discard transaction operation fails

Guess you like

Origin blog.csdn.net/weixin_43272542/article/details/112130847