HGET key field

Available since 2.0.0.

Time complexity: O(1)

Returns the value associated with field in the hash stored at key.

*Return value

Bulk string reply: the value associated with field, or nil when field is not present in the hash or key does not exist.

*Examples

redis> HSET myhash field1 "foo"

  1. (integer) 1

redis> HGET myhash field1

  1. "foo"

redis> HGET myhash field2

  1. (nil)
redis>