← Lessons

quiz vs the machine

Silver1050

Databases

Redis Data Structures Overview

More than a key value store: a server of data structures.

4 min read · intro · beat Silver to climb

Not Just Strings

Redis is often called a key value store, but that undersells it. Every key maps to a value with a type, and Redis ships a rich set of server side data structures you manipulate with atomic commands.

The core types are:

  • String for text, numbers, and raw bytes up to 512 MB.
  • Hash for field value maps, ideal for objects.
  • List for ordered sequences, used as queues and stacks.
  • Set for unordered unique members.
  • Sorted Set for unique members ranked by a score.
  • Stream for append only logs of events.

There are also specialized types like bitmaps, HyperLogLog, and geospatial indexes layered on strings.

Why It Matters

Because the structure lives on the server, you push logic close to the data. Instead of reading a list, editing it in your app, and writing it back, you send one command like push or increment. This is atomic and avoids race conditions, and it cuts network round trips.

Choosing the right type is the main design decision. A leaderboard wants a sorted set; a user profile wants a hash; a job queue wants a list.

Key idea

Redis maps keys to typed data structures and exposes atomic server side commands, so picking the right type is the central modeling choice.

Check yourself

Answer to earn rating on the learn ladder.

1. Why is operating on a Redis data structure server side an advantage?

2. Which type best fits a ranked leaderboard?