Get the App
SLTechnology News&Howtos  ›  Database  › 

What are the types of key in redis

Shulou Source: shulou.com Published: 2022-06-01 14:10:00 11月28日 Update

What are the types of key in redis? In view of this problem, this article introduces the corresponding analysis and answers in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible way.

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

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

Redis supports many features, such as persisting data in memory to a hard disk, using replication to extend read performance, and using sharding to extend write performance.

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.

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

Example

127.0.1 HMSET runoobkey name "redis tutorial" description "redis basic commands for caching" likes 20 visitors 23000OK127.0.0.1:6379 > HGETALL runoobkey1) "name" 2) "redis tutorial" 3) "description" 4) "redis basic commands for caching" 5) "likes" 6) "20" 7) "visitors" 8) "23000"

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

This is the end of the answers to the questions about key in redis. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Tags: Type data question storage memory character string instance performance more hash help support solution different easy ordered easy between information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Xiaomi MariaDB Linux NVidia