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

There are several data types in redis

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

Share

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

Today, I would like to talk to you about several data types of redis, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following for you. I hope you can get something according to this article.

Redis supports five data types: string (string), hash (hash), list (list), set (collection) and zset (sorted set: ordered collection).

String (string)

String is the most basic type of redis, which you can understand as exactly the same type as Memcached, with a key corresponding to a value.

The string type is binary safe. It means that the string of redis can contain any data. Such as jpg images or serialized objects.

The string type is the most basic data type of Redis, and the value of the string type can store 512MB at most.

Hash (hash)

Redis hash is a collection of key-value pairs (key= > value).

Redis hash is a mapping table for field and value of type string, and hash is particularly suitable for storing objects.

List (list)

The Redis list is a simple list of strings sorted in the order in which they are inserted. You can add an element to the head (left) or tail (right) of the list.

Set (collection)

The Set of Redis is an unordered collection of type string.

The collection is implemented through a hash table, so the complexity of adding, deleting, and finding is all O (1).

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 five data types of redis? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.

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