Compared to the data type set introduced in the previous recipe, sorted list is a similar but more complex one in Redis. The word Sorted means each element in this kind of set owns a weight that can be used for sorting, and you can retrieve the elements from the set in order. It's convenient to take advantage of this natively sorted feature in some scenarios for which the sorting is needed all the time. In this recipe, we'll see how to manipulate sorted set.
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
.