KEY operation of the Redis database and transaction management

purpose

  To understand and master a variety of data types the command mode of operation, and the operation of various types of data values. Meanwhile, the main train KEY ability to use the operation command. KEY master key management information, transaction management and transaction rollback routine operations.

Exercise KEYS command, the management of KEY information.

  KEYS pattern

  RENAME

  OF THE

  EXISTS

  MOVE

  RENAMENX

  PERSIST

  EXPIRE

  EXPIREAT

  TTL

 

Transaction Management

  Transaction is normally performed by the following command.

    the Mutlt

    Incr

    exec

Roll back the transaction operation

  MULTI

  DISCARD

 to sum up

Through this experiment, relevant experience and knowledge can be divided into points summarized as follows:

  1. Through the experiment, learning how to use the command to manage the way KEY, and transaction-related content. MULTI and DISCARD command for transaction rollback operations, is very important.
  2. A plurality of commands within the block transaction based on the order which is put into a queue, and finally execute atomically by the EXEC command.
  3. If you are monitoring a (or some) key using the WATCH command, then cancel all monitoring, equivalent to execute the command UNWATCH. Cancel the transaction, giving up all the commands in a transaction block.

 

Guess you like

Origin www.cnblogs.com/Raodi/p/11590115.html