Redis role

  1. Persistent storage, RDB,AOF
  2. Publish and subscribe system
  3. Map information analysis
  4. Hot data
  5. .

Docker installed Redis

  1. docker pull redis docker images
  2. docker run -itd –name redis-test -p 6379:6379 redis
  3. Docker exec it redis-test /bin/bash Go to the redis cli

Basic knowledge of

  • Redis has 16 databases by default and uses the 0 database by default, using select to switch
  • Performance bottlenecks are in memory and network bandwidth

Basic commands

Flushdb: flushhall: flushes all databases EXIST [key] : Move [key] [num] : moves kuy to the library num EXPIRE [key] [SEC] : sets the expiration time of the key SEC secondsCopy the code

Five data types

list

LRANGE list 0-1: List LPUSH list one RPUSH list one LPOP list RPOP list LINDEX list 0 RINDEX list 0 LSET list 1 value1: Update list index value to another value, list does not exist or subscript does not exist, errorCopy the code

set

Copy the code