Home > Database > Redis > body text

What type is the key of redis?

(*-*)浩
Release: 2019-11-02 14:01:11
Original
7882 people have browsed it

Redis is a very fast non-relational (NoSQL) in-memory key-value database that can store mappings between keys and five different types of values.

What type is the key of redis?

The key type can only be string, and the value supports five data types: string, list, set, hash table, and ordered set .

Redis supports many features, such as persisting data in memory to hard disk, using replication to expand read performance, and using sharding to expand write performance. (Recommended learning: Redis video tutorial)

Hash

Redis hash is a key value (key=>value) pair collection.

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

Each hash in Redis can store 232 - 1 key-value pairs (more than 4 billion).

Example

127.0.0.1:6379>  HMSET runoobkey name "redis tutorial" description "redis basic commands for caching" likes 20 visitors 23000
OK
127.0.0.1:6379>  HGETALL runoobkey
1) "name"
2) "redis tutorial"
3) "description"
4) "redis basic commands for caching"
5) "likes"
6) "20"
7) "visitors"
8) "23000"
Copy after login

In the above example, we set some description information (name, description, likes, visitors) of redis to the runoobkey of the hash table.

The above is the detailed content of What type is the key of redis?. 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