Price lookups call the pricing service on every request. Cache them in memory for 60 seconds.
1Intent
2Design
get_price() is wrapped in a TTL cache keyed by product id.
3Edge cases
| Case | How it is handled | Proved by |
|---|---|---|
| Price changes | stale for at most 60 s | test_ttl_expires |
4Verification
| Proves | Command | Result | Link | Fails on revert |
|---|---|---|---|---|
| Cache works | pytest -q |
✅ 140 passed | — | yes |
5Not verified / assumptions
- Memory use with all 40k products was not measured.
6Rollback
Revert the commit.
7Security impact
None.
8Agent reviews
| Round | Reviewers | Findings | Fixed | Dismissed |
|---|---|---|---|---|
| 1 | Python | 0 | 0 | 0 |
9Judge this
- A changed discount can be stale for up to 60 seconds. Is that fine?
10Changes
| # | Repo | Merge request | What it changes | Status |
|---|---|---|---|---|
| 1 | demo | local only | the change described above | open |