Home > Database > Redis > What are the redis data structures?

What are the redis data structures?

藏色散人
Release: 2019-06-17 15:25:39
Original
15233 people have browsed it

What are the redis data structures?

#What are the data structures of redis?

Recommended: "redis video tutorial"

Strings (strings):

Storage integers (such as Counter) and string (nonsense...), some companies also use it to store serialized data such as json/pb, which is not recommended and wastes memory;

Hash table (hashes):

Storage configuration, objects (such as users, products), the advantage is that you can access some keys, which is suitable for frequently changing or some keys that require atom operations;

List ( lists):

can be used to store the latest user updates and timelines. The advantage is that it is orderly and the elements must be repeatable without deduplication;

sets ):

Unordered, unique, can be used if strict uniqueness is required;

Sorted sets:

The ordered version of the collection is very easy to use and can be considered for complex scenarios such as ranking;

Bitmaps:

This is not new The data type can only operate on the string type in the form of a single bit, but has not been actually used. Many people on the Internet use bitmaps for active user statistics and user sign-in functions, and the performance is much higher than loading the database.

Counter (hyperloglogs, translation to be determined):

Like the name, adding an element only records the number of elements, and does not store the element itself, saving space and avoiding repeated count , this feeling can be realized directly by using incr;

Geographic space (geospatial indexes):

is used for geographical location queries, such as the distance between two points, How many elements are there near a point is suitable for scenarios where the point is relatively fixed, or where only the current location is considered. It is not suitable for situations such as nearby people. First, the points within a certain period of time need to be considered, and second, the points are frequently updated, which is stressful. bigger.

The above is the detailed content of What are the redis data structures?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template