Redis interview questions

Prodigal son Tang Shao 2022-02-13 07:29:24 阅读数:17

redis interview questions

Redis Interview questions

1.redis What is it? ?

redis It's a key-value Non relational database , Read data fast , It can be used as a cache to reduce the load pressure of the database .

2.redis What data types are supported ?

redis There are five types , Namely String,list,hash,set,zset

(1)String type : Can store any type of data , Like strings , Integers and floating point numbers

(2)list type : Its structure is data duplication , Orderly

(3)hash type : Its structure is value It's divided inside key-value, Suitable for storing object data

(4)set type : Its structure is that the data cannot be repeated , disorder

(5)zset type : Its structure is that the data cannot be repeated , Orderly

2. Suitable for the scene

1) Cache data

2) Distributed lock

3.Redis key How to set the expiration time and permanent validity of ?

EXPIRE and PERSIST command

4.redis How to implement distributed locks ?

5.redis The persistence of

redis Persistence has RDB Strategy ,AOF Strategy ,redis Persistence of means redis Will write the data in the memory to the hard disk , stay redis Load this data on reboot , So as to minimize the impact of cache loss .

RDB Strategy : The frequency of persistence is not high , Data loss is serious , Data security is low , but redis It provides users with higher performance of operating data

AOF Strategy : Second persistence , With higher data security , If the server crashes , Only lose 1 Seconds of data

copyright:author[Prodigal son Tang Shao],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/02/202202130729222983.html