Redis HGETALL – How to get all the fields and its values contained in hash
3 weeks ago Lalit Bhagtani 0
In this tutorial, we will learn about how to get all the fields and its associated values contained in the hash value stored at a key, by using a COMMAND – HGETALL in redis-cli.
Empty list is returned, if key does not exist and error is returned, if key exist but value stored at the key is not of hash datatype. The syntax of redis HGETALL command is as follows :-
redis host:post> HGETALL <keyname>
- (array) reply, representing the list of fields and its values in the hash. - Empty list, if key does not exist. - Error, if key exist and value stored at the key is not a hash.
That’s all for how to get all the fields and its associated values contained in the hash value stored in redis datastore. If you liked it, please share your thoughts in comments section and share it with others too.