Latest web development tutorials

Redis Hget command

Redis hash (Hash)

Redis Hget command returns the value of the hash table for the specified field.

grammar

redis Hget basic command syntax is as follows:

redis 127.0.0.1:6379> HGET KEY_NAME FIELD_NAME 

Available versions

> = 2.0.0

return value

Returns the value of a given field. If a given field or key does not exist, returns nil.

Examples

# 字段存在

redis> HSET site redis redis.com
(integer) 1

redis> HGET site redis
"redis.com"


# 字段不存在

redis> HGET site mysql
(nil)

Redis hash (Hash)