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--
What data can be stored in the redis cache? Perhaps many people do not understand, in order to let you understand better, the editor summed up the following content, I hope you can gain something according to this article.
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)
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)
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.)
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.
Zset (sorted set: ordered set)
Redis zset, like set, is a collection of elements of type string, and duplicate members are not allowed.
The difference is that each element is associated with a score of type double. Redis sorts the members of the collection from small to large by scores.
The members of the zset are unique, but the score can be repeated.
After reading the above, do you have any further understanding of the stored data cached by redis? If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading.
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.