redis HMGET command


  Translation results:

get

英[get] 美[ɡɛt]

vt. Get; catch; persuade; receive (punishment, etc.)

vt.& vi. Arrive, come

vi. Become; start; try to deal with; obtain benefits or wealth

n. Reproduce, cub; profit

Third person singular : gets present participle: getting past tense: got past participle: got gotten

redis HMGET commandsyntax

Function: Return the value of one or more given fields in the hash table key.

Syntax: HMGET key field [field ...]

Description: If the given field does not exist in the hash table, then Returns a nil value. Because a non-existent key is treated as an empty hash table, a HMGET operation on a non-existent key will return a table with only nil values.

Available versions: >= 2.0.0

Time complexity: O(N), N is the number of given domains.

Returns: A table containing associated values ​​for multiple given fields. The table values ​​are arranged in the same order as the request order for the given field parameters.

redis HMGET commandexample

redis> HMSET pet dog "doudou" cat "nounou"    # 一次设置多个域
OK
redis> HMGET pet dog cat fake_pet             # 返回值的顺序和传入参数的顺序一样
1) "doudou"
2) "nounou"
3) (nil)                                      # 不存在的域返回nil值

Home

Videos

Q&A