English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Redis hash ist ein Mapping von String-Typen (Feld) und (Wert), das besonders gut für die Speicherung von Objekten geeignet ist.
Jeder Hash in Redis kann mehrere Schlüssel-Wert-Paare speichern 232 - 1 Schlüssel-Wert-Paar (40 mehr als Milliarden).
127.0.0.1:6379> HMSET w3codeboxkey name "redis tutorial" description "redis basic commands for caching" likes 20 visitors 23000 OK 127.0.0.1:6379> HGETALL w3codeboxkey 1) "name" 2) "redis tutorial" 3) "description" 4) "redis basic commands for caching" 5) "likes" 6) "20" 7) "visitors" 8) "23000"
In den obigen Beispielen haben wir einige Beschreibungen von Redis (name, description, likes, visitors) in den Hash-Tabelle w3codeboxkey dargestellt.
Die folgende Tabelle zeigt die grundlegenden Redis-Hash-Befehle:
Nummer | Befehl und Beschreibung |
---|---|
1 | HDEL key field1 [field2] Löschen Sie ein oder mehrere Felder der Hash-Tabelle |
2 | HEXISTS key field Überprüfen Sie, ob das angegebene Feld in der Hash-Tabelle key existiert. |
3 | HGET key field Get the value of the specified field stored in the hash table. |
4 | HGETALL key Get all fields and values of the specified key in the hash table. |
5 | HINCRBY key field increment Add an increment to the integer value of the specified field in the hash table key. |
6 | HINCRBYFLOAT key field increment Add an increment to the floating-point value of the specified field in the hash table key. |
7 | HKEYS key Get all fields in all hash tables. |
8 | HLEN key Get the number of fields in the hash table. |
9 | HMGET key field1 [field2] Get the values of all specified fields. |
10 | HMSET key field1 value1 [field2 value2 ] Set multiple field-value (domain-Set the key-value pair to the hash table key. |
11 | HSET key field value Set the value of the field field in the hash table key to value. |
12 | HSETNX key field value Set the value of the hash table field only if the field does not exist. |
13 | HVALS key Get all values in the hash table. |
14 | HSCAN key cursor [MATCH pattern] [COUNT count] Iterate over key-value pairs in a hash table. |
For more commands, please refer to:https://redis.io/commands