chore: init saasshop repo + sql migrations runner + gitee go
This commit is contained in:
40
docs/REDIS_CACHE_PLAN.md
Normal file
40
docs/REDIS_CACHE_PLAN.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# Redis 缓存接入计划
|
||||
|
||||
## 当前阶段
|
||||
- 默认缓存驱动已切换为 `redis`
|
||||
- 优先接入商家后台高频读场景
|
||||
- 商家仪表盘统计
|
||||
- 商家商品列表
|
||||
|
||||
## 当前缓存 Key 设计
|
||||
- `merchant:{merchantId}:dashboard:stats`
|
||||
- `merchant:{merchantId}:products:list`
|
||||
|
||||
配合 `.env` 中的:
|
||||
- `CACHE_STORE=redis`
|
||||
- `CACHE_PREFIX=saasshop-cache-`
|
||||
|
||||
实际 Redis 中最终 key 会叠加 Laravel 前缀,避免与其他项目冲突。
|
||||
|
||||
## TTL 策略
|
||||
- 商家仪表盘统计:10 分钟
|
||||
- 商家商品列表:10 分钟
|
||||
|
||||
## 失效策略
|
||||
- 商品新增 / 更新 / 删除:
|
||||
- 清理 `merchant:{merchantId}:products:list`
|
||||
- 清理 `merchant:{merchantId}:dashboard:stats`
|
||||
- 订单状态更新:
|
||||
- 清理 `merchant:{merchantId}:dashboard:stats`
|
||||
|
||||
## 设计原则
|
||||
1. key 必须带 merchant 维度,避免跨商家串缓存
|
||||
2. 优先缓存读多写少页面,不先缓存复杂写流程
|
||||
3. 失效优先正确,再追求更细粒度
|
||||
4. 后续可扩展:分类列表缓存、总台管理统计缓存、配置缓存预热
|
||||
|
||||
## 下一步建议
|
||||
1. 给商品分类列表增加单独缓存
|
||||
2. 给总台管理仪表盘增加缓存层
|
||||
3. 评估是否引入 tag(如果后续缓存驱动与场景需要)
|
||||
4. 后续把订单列表也纳入缓存,但要先设计分页和筛选条件 key 规范
|
||||
Reference in New Issue
Block a user