016 Redis usage scenarios

I. Overview

redis is not available in every situation, it must be used in the right situation.


 

2. Cache

The most commonly used scenario of redis is to help implement caching, and previous caching can be done using redis.


 

3. Get the latest N data

You can use list to complete, it is very convenient to get the previous data.


 

4. Use of leaderboards

We can use zset to do this, using weights to sort the set.


 

5. Counter

This we use the string type to complete.


6. Storage relationship

For example, query the common crowd of A and B.

We can use set to do it.


 

7. Queue and stack structure of the build system

We can do it with list, and we can do it with priority queue with zset.


 

8. Real-time analysis system

For example, an account password cannot be entered incorrectly 3 times. When it exceeds 3 times, it is not allowed to log in again today.


 

Nine.session

We can create objects limited by life, we can do it using redis.


In short, redis can help us manage data that is not required by transactions.

 

Guess you like

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