A brief description of Redis

Redis has 16 libraries by default, from db0 to db15 . If you do not specify which db to use when connecting to redis, db0 will be used by default .



 

Under redis, databases are identified by an integer index instead of a database name.

 

One of the functions of dividing 16 DBs is to facilitate the use of different DBs for different projects, to prevent data confusion, and to facilitate data viewing. 

 

The number of databases is configurable, by default it is 16. Modify the databases configuration item under redis.conf.

 

The command line is simple to use:

//Switch to library 1

select 1

 

//Set the value of key name to Zhang San

set 'name' 'Zhang San'

 

//Get the value of the key is the name

get name

 

//Clear the data under the current database, it will not affect other databases.

flushdb

 

//Clear all data (including all libraries) of the Redis instance, be careful before executing this command.

flushall

 

//delete the record whose key is name

del name

 

//Check if there is a key named name, if it exists, it returns 1, if it does not, it returns 0.

exists name

 

 

 

 

 

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326177348&siteId=291194637