Chapter 3. Commands in Redis


This chapter covers

  • String, list, and set commands
  • Hash and sorted set commands
  • Publish/subscribe commands
  • Other commands

In this chapter, we’ll primarily cover commands that we haven’t already covered in chapters 1 and 2. By learning about Redis through its commands, you’ll be able to build on the examples provided and have a better understanding of how to solve your own problems. If you’re looking for short examples that are more than the simple interactions I show here, you’ll find some in chapter 2.

The commands that are highlighted in this chapter are broken down by structure or concept, and were chosen because they include 95% or more of the typical Redis calls in a variety of applications. The examples are interactions in the console, similar to the way I introduced each of the structures in chapter 1. Where appropriate, I’ll reference earlier or later sections that use those commands.

In the section for each of the different data types, I’ll show commands that are unique to the different structures, primarily focusing on what makes those structures and commands distinct. Let’s start by seeing how Redis STRINGs offer more than just GET and SET operations.

Additional documentation for commands not covered

In this chapter, I only cover the most commonly used commands or those commands that we’ll use in later chapters. If you’re looking for a full command and documentation reference, you can visit

3.1. Strings

3.2. Lists

3.3. Sets

3.4. Hashes

3.5. Sorted sets

3.6. Publish/subscribe

3.7. Other commands

3.8. Summary