In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail which data need to be cached by redis. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
String type is the most basic data storage type in Redis, which is a sequence of bytes. It is binary safe in Redis, which means that this type can accept data in any format, such as JPEG image data, Json object description information, etc., is a standard key-value, generally to store strings, integers and floating-point numbers.
1. String string:
String type is the most basic data storage type in Redis, which is a sequence of bytes. It is binary safe in Redis, which means that this type can accept data in any format, such as JPEG image data, Json object description information, etc., is a standard key-value, generally to store strings, integers and floating-point numbers. The maximum length of data that Value can hold is 512MB
Application scenarios: very common scenarios are used to count the number of website visits, the current number of people online, and so on. Incr command (+ + operation)
two。 List list:
The list of Redis allows users to push in or pop elements from both ends of the sequence. The list is an ordered and repeatable sequence of multiple string values, which is a linked list structure, so the time complexity of adding elements to both ends of the list is 0 (1). The closer the elements are, the faster it is to get them. This means that even if it is a list of tens of millions of elements, it is extremely fast to get 10 records from the head or tail. The maximum number of elements that can be contained in a List is 4294967295.
Application scenarios: 1. The list of the latest news. two。 Message queuing to complete message exchange between multiple programs. You can use the push operation to store the task in the list (producer), and then the thread is taking the task out for execution with the pop operation. (consumer)
3. Hash hash:
Hashes in Redis can be thought of as map containers with String key and String value, and multiple key-value can be stored in a single key. Each Hash can store 4294967295 key-value pairs.
Application scenarios: such as storing, reading, modifying user attributes (name,age,pwd, etc.)
4. Collection set:
The collection of Redis is unordered and unrepeatable, and like lists, it is efficient to perform inserts and deletions and to determine whether an element exists. The biggest advantage of set is that it can perform intersection and difference set operation. The maximum number of elements that a Set can contain is 4294967295.
Application scenarios: 1. Use intersection to find common friends. two。 Using uniqueness, you can count all individual IP visits to the site. 3. When recommended by friends, you can find the intersection according to tag. If it is greater than a certain threshold (critical value), you can recommend it.
On which data needs redis cache to share here, I hope the above content can be of some help to you, you can learn more knowledge. If you think the article is good, you can share it for more people to see.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.