Get the App
SLTechnology News&Howtos  ›  Database  › 

What are the five data types of Redis

Shulou Source: shulou.com Published: 2022-05-31 15:39:32 10月04日 Update

This article introduces the relevant knowledge of "what are the five data types of Redis". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The five big data types of Redis

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. The string value in a redis can be up to 512m.

Hash (hash, similar to Map in java)

Redis hash is a collection of key-value pairs.

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

Similar to Map in Java

List (list)

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

Its underlying layer is actually a linked list.

Set (collection)

The Set of Redis is an unordered collection of type string. It is implemented through the HashTable implementation.

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.

This is the end of the content of "what are the five data types of Redis". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Tags: Type data element score character string member content actual object more knowledge sort different practical orderly secure exactly the same from small to big learned Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info OPPO Reno MariaDB Linux Redmi