Function
has
(url: string, now = Date.now())
Source from the content-addressed store, hash-verified
| 7 | const cache = new Map<string, number>(); |
| 8 | |
| 9 | const has = (url: string, now = Date.now()): boolean => { |
| 10 | const expiresAt = cache.get(url); |
| 11 | if (!expiresAt) { |
| 12 | return false; |
| 13 | } |
| 14 | |
| 15 | if (expiresAt > now) { |
| 16 | return true; |
| 17 | } |
| 18 | |
| 19 | cache.delete(url); |
| 20 | return false; |
| 21 | }; |
| 22 | |
| 23 | const add = (url: string, now = Date.now()): void => { |
| 24 | cache.delete(url); |
Callers
nothing calls this directly
Tested by
no test coverage detected