chore: init saasshop repo + sql migrations runner + gitee go

This commit is contained in:
萝卜
2026-03-10 11:31:02 +00:00
commit 50f15cdea8
210 changed files with 29534 additions and 0 deletions

40
docs/REDIS_CACHE_PLAN.md Normal file
View 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 规范