You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
## ADDED Requirements
### Requirement: 刷新接口双写
系统应当在刷新接口中实现 Redis 和 MySQL 的同步双写,保证数据一致性。
#### Scenario: 刷新接口双写成功
- **WHEN** 用户调用刷新接口更新行情数据
- **THEN** 系统先删除 Redis 缓存,再写入 MySQL, 最后更新 Redis 缓存
#### Scenario: MySQL 写入失败
- **WHEN** 刷新接口写入 MySQL 失败
- **THEN** 系统返回错误响应,不更新 Redis 缓存,保证数据一致性
#### Scenario: Redis 写入失败
- **WHEN** 刷新接口写入 MySQL 成功但 Redis 写入失败
- **THEN** 系统返回成功响应( MySQL 数据已持久化),输出 Redis 写入失败警告日志
### Requirement: 双写顺序保证
系统应当保证双写的顺序:先写 MySQL, 再更新 Redis。
#### Scenario: 双写顺序
- **WHEN** 刷新接口执行双写
- **THEN** 系统先写入 MySQL 并确认成功,再更新 Redis 缓存
### Requirement: 缓存回填一致性
系统应当在缓存未命中回填时保证回填数据与 MySQL 数据一致。
#### Scenario: 缓存未命中回填
- **WHEN** Redis 缓存未命中且从 MySQL 读取数据
- **THEN** 系统将 MySQL 数据回填到 Redis, TTL 设置为 30 天