The hash data type represents mapping relationships between fields and values, just like maps or dictionaries in some programming languages. The Redis dataset itself can be viewed as a hash, where keys of strings are mapped to data objects such as strings and lists, as we have seen in the previous two recipes. The data objects of Redis can again use hashes, whose fields and values must be strings. To distinguish from Redis keys, we use fields to denote keys in Redis hash-value objects. The hash is a perfect data type for storing an object's properties. In this recipe, we will use hashes to store restaurants' information, such as address, phone number, rating, and so on.
You need to finish the installation of the Redis Server, as we described in the Downloading and installing Redis recipe in Chapter 1, Getting Started with Redis, and connect to the Redis Server by redis-cli
.