Five data types commonly used in Redis

1.String (string)

The string type is binary safe. Means redis string can contain any data. Such as jpg images or serialized objects.

The string type is the most basic data type of Redis, and the string value in a redis can be up to 512M

 

2.Hash

A Redis hash is a collection of key-value pairs.
Redis hash is a mapping table of field and value of string type, and hash is especially suitable for storing objects.


Similar to Map<String, Object> in Java

 

3. List (list)

Redis lists are simple lists of strings, sorted by insertion order. You can add an element to the head (left) or tail (right) of the list.
Its bottom layer is actually a linked list

 

4.Set (collection)

Redis's Set is an unordered collection of string type. It is implemented through HashTable,

 

5.zset (sorted set: ordered set)

Redis zset, like set, is also a collection of elements of type string, and does not allow duplicate members.
The difference is that each element is associated with a fraction of type double.
Redis sorts the members of the set from small to large through scores. The members of zset are unique, but the score can be repeated.

The string type is binary safe. Means redis string can contain any data. Such as jpg images or serialized objects.

The string type is the most basic data type of Redis, and the string value in a redis can be up to 512M

 

2.Hash

A Redis hash is a collection of key-value pairs.
Redis hash is a mapping table of field and value of string type, and hash is especially suitable for storing objects.


Similar to Map<String, Object> in Java

 

3. List (list)

Redis lists are simple lists of strings, sorted by insertion order. You can add an element to the head (left) or tail (right) of the list.
Its bottom layer is actually a linked list

 

4.Set (collection)

Redis's Set is an unordered collection of string type. It is implemented through HashTable,

 

5.zset (sorted set: ordered set)

Redis zset, like set, is also a collection of elements of type string, and does not allow duplicate members.
The difference is that each element is associated with a fraction of type double.
Redis sorts the members of the set from small to large through scores. The members of zset are unique, but the score can be repeated.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325132204&siteId=291194637