()
| 317 | }; |
| 318 | |
| 319 | const loadFromStore = async (): Promise<CacheEntry | null> => { |
| 320 | if (!store) return null; |
| 321 | // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: the L2 store is an optimization; any failure degrades to an upstream fetch |
| 322 | try { |
| 323 | const storeReadStartedAt = Date.now(); |
| 324 | const stored = await store.get(url); |
| 325 | lastStoreReadMs = Date.now() - storeReadStartedAt; |
| 326 | if (!stored) return null; |
| 327 | const candidate = entryFrom(stored); |
| 328 | if (!isUsable(candidate)) return null; |
| 329 | entry = candidate; |
| 330 | storeHitCount += 1; |
| 331 | return candidate; |
| 332 | } catch { |
| 333 | return null; |
| 334 | } |
| 335 | }; |
| 336 | |
| 337 | /** A refresh the caller waits on — the only kind that costs it latency. */ |
| 338 | const refreshBlocking = (): Promise<CacheEntry> => { |
no test coverage detected