Home  >  Article  >  Database  >  What does the redis database mainly store?

What does the redis database mainly store?

(*-*)浩
(*-*)浩Original
2019-11-20 11:56:333290browse

Redis is an open source log-type Key-Value database written in ANSI C language, abides by the BSD protocol, supports the network, can be memory-based and persistent, and provides APIs in multiple languages.

What does the redis database mainly store?

Redis database can access data types: string (string), hash (hash), list (list), set (set) ) and zset (sorted set: ordered set).

# String (String) (Recommended Learning: Redis Video Tutorial )

## STRING is the most basic type of Redis, you can It is understood to be exactly the same type as Memcached, with one key corresponding to one value.

The string type is binary safe. This means that the string of redis can contain any data. For example, jpg images or serialized objects.

The string type is the most basic data type of Redis. The string type value can store up to 512MB.

Hash (Hash)

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

Redis hash is a mapping table of string type fields and values. Hash is particularly suitable for storing objects.

List (List)

Redis lists are simple lists of strings, sorted in insertion order. You can add an element to the head (left) or tail (right) of the list.

Set (set)

Redis’ Set is an unordered collection of string type.

Sets are implemented through hash tables, so the complexity of adding, deleting, and searching is O(1).

zset (sorted set: ordered set)

Redis zset, like set, is also a collection of string type elements, and duplicate members are not allowed.

The difference is that each element is associated with a double type score. Redis uses scores to sort the members of the collection from small to large.

The members of zset are unique, but the scores can be repeated.

The above is the detailed content of What does the redis database mainly store?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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
Previous article:How to match 2 redisNext article:How to match 2 redis