In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains the "Redis collection set common commands", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "Redis collection set common commands" bar!
Set
> sadd name hello (integer) 1 > sadd name hello # repeat, cannot insert (integer) 0 > sadd name i am ok (integer) 3 > smembers name "hello"I"am"ok" > sismember name hello # check whether the value exists (integer) 1 > scard name # get length (integer) 4 > spop name # get the first "hello" ZSet
Zset is an ordered collection, it has the characteristics of SortedSet and HashMap in java, it is a collection that ensures that the internal value is unique, and there is a sort field score to sort, and its internal structure implements a jump list, commonly known as a jump table. Next, we will find a time to explain the implementation of the jump table in zset. Generally speaking, ranking is the most frequently used zset, such as the ranking of gifts in live streaming, the ranking of the number of fans, and so on.
Let's use some common commands.
> zadd name 2 world (integer) 1 > zadd name 1 hello (integer) 1 > zrange name 0-1 # sort "hello"world" > zrevrange name 0-1 # in ascending score order "world"hello" > zcard name # get the number of collections (integer) 2 > zscore name hello # get Internal score1.0 > zrem name world # Delete (integer) 1
Generally speaking, when we search an ordered list, we can use to traverse the entire list, but in order to consider the performance, we use dichotomy is the fastest, but the list needs to be randomly inserted and deleted, so the data is not suitable to do so. So we try to use linked lists, linked lists support random insertion and deletion very well, but linked lists can not be quickly found by dichotomy. So we use a method called jump list in redis to implement zset.
Thank you for your reading, the above is the content of "Redis collection set common commands", after the study of this article, I believe you have a deeper understanding of the problem of Redis collection set common commands, the specific use of the situation also needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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: 279
*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.