Redis in a new project usage scenarios
type of data | scenes to be used |
string | For example, I want to know when a blockade Ip address, Incrby command (this command is the number of records accessed) |
Hash | Store user information [id, name, age] Hset(user,id,101) Hset (user, name, Joe Smith) Hset(user,age,36) Case ---------------------- --------------- modification Hget (user,id) Hset(user,id,102) ------------------ why not use the type String to store ------------------------- ----- Set (user, a string of user information) get (user) This, then the user will get all the information, deserialize, reducing the use of performance |
List | Achieve a ranking the latest news, a List can also use the push command of such set exists List task, while the task using another command to remove (pop) from the collection
Redis ---- list data type to simulate the message queue. (Example: spike activity in the electricity business, it can be used in this way, to complete) |
Set | Automatic duplication. For example, everyone's friend meager existence in the set (set) in. Such people seek mutual friend of the two operations, we simply can claim the intersection () |
token | Can be repeated in order to carry out certain conditions for the right sort, Jingdong commodity Ranking, also ranked by price |