热门面试题与答案和在线测试
面向面试准备、在线测试、教程与实战练习的学习平台

通过聚焦学习路径、模拟测试和面试实战内容持续提升技能。

WithoutBook 将分主题面试题、在线练习测试、教程和对比指南整合到一个响应式学习空间中。

Chapter 4

Hashes, Lists, Sets, Sorted Sets, and Redis Data Structures

Use Redis as more than a string store by learning the built-in data structures that enable richer application patterns.

Inside this chapter

  1. Why Data Structures Make Redis Special
  2. Hashes
  3. Lists
  4. Sets and Sorted Sets
  5. Real Example

Series navigation

Study the chapters in order for the clearest path from Redis basics to advanced cache architecture, operations, and distributed-system design. Use the navigation at the bottom to move smoothly through the full tutorial series.

Tutorial Home

Chapter 4

Why Data Structures Make Redis Special

Redis is often called a data structure server because it supports multiple structured value types, not only plain strings. This lets developers model useful application behavior efficiently.

Chapter 4

Hashes

HSET user:42 name "Asha" email "asha@example.com"
HGET user:42 email

Hashes are useful for grouped fields such as user profiles, configuration objects, or counters per entity.

Chapter 4

Lists

LPUSH jobs "task-1"
RPOP jobs

Lists can support queue-like processing, ordered items, or activity streams.

Chapter 4

Sets and Sorted Sets

Sets are useful when uniqueness matters. Sorted sets add ordering through scores, which makes them powerful for ranking and time-based patterns.

ZADD leaderboard 1200 "player-1"
ZRANGE leaderboard 0 -1 WITHSCORES
Chapter 4

Real Example

An online game may use hashes for player profiles, sets for unlocked achievements, lists for event queues, and sorted sets for leaderboards. Redis data structures let one platform support many kinds of state efficiently.

版权所有 © 2026,WithoutBook。