Interview questions

redis What are the data types ? Which scenarios are suitable for use ?

Psychological analysis of interviewers

Analysis of interview questions

redis There are mainly the following data types :

*
string

*
hash

*
list

*
set

*
sorted set

string

This is the simplest type , It's ordinary set and get, Do simple KV cache .

hash

This is similar map A structure of , This is generally structured data , Like an object ( The premise is that the object is not nested with other objects ) To cache in redis
in , And then every time I read and write the cache , It can be operated on hash A field in the .

list

list There is a sequence table , This one can play a lot of tricks .

For example, you can pass the list Store some tabular data structures , Similar to fan list , A list of comments on an article or something .

For example, you can pass the lrange command , Read the elements in a closed interval , Can be based on list Realize paging query , This is a great feature , be based on redis
Implementation of simple high performance paging , You can do things like microblogging that pull down and page constantly , High performance , Just go page by page .

For example, we can build a simple message queue , from list Head in , from list Get it out of the tail .

set

set It's an unordered set , Automatic weight removal .

Two big V The fans are all in two set in , Yes, two set Do intersection .

sorted set

sorted set It's sorted set, De duplication but can be sorted , Give a score when you write it in , Automatically sort by score .

Technology
©2019-2020 Toolsou All rights reserved,
Python Garbage collection and memory leak hive Summary of processing methods for a large number of small files The difference between memory overflow and memory leak , Causes and Solutions Create data mysql Library process You don't know ——HarmonyOS stay Vue Use in Web WorkerSparkSQL Achieve partition overlay write msf Generate Trojan horse attack android mobile phone Linux Page replacement algorithm C Language implementation Django Personal blog building tutorial --- Time classified archiving