Files
zhuangang/topics/backend/redis/index.md
T

44 lines
1.6 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
id: backend.redis.index
title: Redis
type: index
domain: backend
stack: [redis]
tags: [缓存, Redis, 分布式锁, 限流]
week: [3, 6, 14]
---
# Redis
内存数据库,后端面试必考:缓存、计数、排行榜、分布式锁、限流、简单队列。本计划在项目一里做缓存和限流(第 3 周),在 RAG 服务里缓存检索结果(第 6 周),第 14 周补齐高并发相关题目。
## 学习路线
| 顺序 | 课程 | 级别 | 预计 |
| --- | --- | --- | --- |
| 1 | [数据结构和常用命令:String、Hash、List、Set、ZSet、Stream](01-data-structures.md) | 基础 | 2 小时 |
| 2 | [缓存模式:旁路缓存、穿透 / 击穿 / 雪崩、一致性](02-cache-patterns.md) | 进阶 | 3 小时 |
| 3 | [分布式锁和限流:SET NX、Lua、令牌释放、固定窗口与滑动窗口](03-lock-ratelimit.md) | 进阶 | 3 小时 |
## 企业场景
- [抢购库存预扣:Lua 原子扣减、防重复下单、异步落库](scenarios/stock-reservation.md)
## 面试题
- [Redis 面试题](interview.md)
## 示例代码
- [examples/stock-lock-ratelimit](examples/stock-lock-ratelimit/):Go + go-redis 实现库存预扣、分布式锁、滑动窗口限流;设置 `REDIS_URL` 后运行集成测试
## 在 16 周计划中
- [第 3 周:项目一(缓存、限流)](../../../plan/week03-project1.md)、[第 6 周:RAG 服务缓存](../../../plan/week06-rag-2.md)、[第 14 周:后端扩展](../../../plan/week14-backend-extend-deploy.md)
## 官方资料
- Redis 文档:https://redis.io/docs/latest/
- 命令参考:https://redis.io/docs/latest/commands/
- go-redis:https://redis.uptrace.dev/