Redis role
- Persistent storage, RDB,AOF
- Publish and subscribe system
- Map information analysis
- Hot data
- .
Docker installed Redis
- docker pull redis docker images
- docker run -itd –name redis-test -p 6379:6379 redis
- 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