Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the data structures in redis

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The editor will share with you what data structures there are in redis. I hope you will gain a lot after reading this article. Let's discuss it together.

What are the redis data structures?

String (strings):

Store integers (such as counters) and strings (nonsense. ), some companies also use it to store serialized data such as json/pb, which is not recommended, which is a waste of memory

Hash table (hashes):

Storage configuration, objects (such as users, goods), the advantage is that part of the key can be accessed, which is suitable for frequently changing or partial key requiring atom operation.

List (lists):

Can be used to store the latest user dynamics, timeline, the advantage is orderly, determine that the elements can be repeated, do not repeat

Collection (sets):

Unordered, unique, can be used for those that require strict uniqueness

Ordered set (sorted sets):

An ordered version of the collection, easy to use, for complex scenarios such as rankings can be considered

Bitmap (bitmaps):

This is not a new data type, but you can manipulate the string type in the form of a single bit without actually using it. Many people on the Internet use bitmaps to do active user statistics and user check-in function, and the performance is much higher than going to the database load.

Counter (hyperloglogs, translation to be determined):

For example, adding an element only records the number of elements, does not store the element itself, saves space and avoids repeating count. This feeling can be realized directly with incr.

Geospatial (geospatial indexes):

It is used to query the geographical location, such as the distance between two points, how many elements are near a point, the scene where the fit point is relatively fixed, or only considering the scene of the current location, which is not suitable for people nearby. One is to consider the points within a certain period of time, and the other is that the points are updated frequently, resulting in greater pressure.

After reading this article, I believe you have a certain understanding of the data structures in redis, want to know more about it, 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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report