Commit 657f1c0
committed
Fix: Prevent false HIT reporting and add cache status to exception handler
Two critical fixes to ensure accurate HIT/MISS reporting:
1. Fixed false HIT on lock timeout fallback (line 191-203)
BEFORE: Cache::get() ?? $callback() then default to HIT
PROBLEM: If cache is empty, callback executes but reports HIT
AFTER: Explicitly check if Cache::get() returns data
- If cached data exists: set HIT
- If cache is empty: execute callback and set MISS
2. Added cache status to exception handler (line 216-217)
BEFORE: No status set in catch block
PROBLEM: Exception path has undefined cache status
AFTER: Explicitly set MISS when exception occurs
Result: Cache status now accurately reflects whether data was
pulled from cache (HIT) or computed via callback (MISS)1 parent f86fa1c commit 657f1c0
1 file changed
Lines changed: 14 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
190 | 190 | | |
191 | 191 | | |
192 | 192 | | |
193 | | - | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
194 | 203 | | |
195 | 204 | | |
196 | | - | |
| 205 | + | |
197 | 206 | | |
198 | 207 | | |
199 | 208 | | |
| |||
204 | 213 | | |
205 | 214 | | |
206 | 215 | | |
207 | | - | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
208 | 219 | | |
209 | 220 | | |
210 | 221 | | |
| |||
0 commit comments