This is the eighth blog post of the back-end interview collection - redis
interview skills❗❗❗
1. Introduce redis
Redis
It is a non-relational database, which is mainly used in our project to store hot data, reduce the pressure on the database, single-threaded pure memory operation, and adopts a non-blocking multiplexing mechanism, which is single-threaded monitoring, used in our project IO
to springdata-redis
operate redis
.
There are many places used in our project redis
. For example, the hot data on the home page and the data in the data dictionary are all stored in hot words to improve access speed.
redis
There is5
a data type: string、list、hash、set、zset
, we commonly use string
, list
and hash
.
-
Some simple
key-value
types are stored instring
the type, such as some system switches, whether to open registration, etc. -
There are also some stored in
hash
, for example, the recommended data and popular data of our homepage are all stored in hash. A fixed string is used as the key, the id of each piece of data is used as the field, and the corresponding data is stored as the value
redis
There are also two persistence methods:
-
One is that
RDB
this is alsoredis
the default persistence method.-
This method stores data in the form of snapshots, within a fixed period of time such as
-