-
-
Notifications
You must be signed in to change notification settings - Fork 361
Open
Description
I'm seeing another issue with using sinon timers. With a faked performance.now, the initial result will be 0
until you advance the timer.
But the default fill of the starts array is 0 https://github.com/isaacs/node-lru-cache/blob/main/src/index.ts#L1478. That means any value set in the cache before you manually advance a timer is seem as not having a TTL.
You could argue in a real world situation you won't get a performance.now of 0. I think ideally the starts array should be initialised with null/undefineds instead? It seems like a bug that a cache with a ttl set should see it as not having a ttl because perf.now returned 0.
Metadata
Metadata
Assignees
Labels
No labels