Conversation
- entries() and values() previously called get() during iteration which moved items during traversal - Changed to build a lookup map first for O(1) access without mutating LRU order - Updated @param docs to clarify optional keys parameter behavior - Removed unnecessary comments - All 53 tests pass with 100% coverage
🤖 Augment PR SummarySummary: Refines Changes:
Technical Notes: Both methods now walk the internal linked list once to build a 🤖 Was this summary useful? React with 👍 or 👎 |
- keys() was calling String(x.key) which added unnecessary overhead - No functional benefit since map lookups use original key types - Improves GET throughput by ~2.6%
7a49f75 to
65ae3b5
Compare
|
augment review |
| let x = this.first; | ||
|
|
||
| while (x !== null) { | ||
| entryMap[x.key] = x.value; |
There was a problem hiding this comment.
Using entryMap[x.key] = x.value means entries()/values() no longer go through get(), so TTL expiration won’t be enforced (expired items won’t be deleted and may be returned as if still valid). If TTL is expected to apply to these accessors too, this changes observable behavior for caches with ttl > 0.
Severity: high
Other Locations
src/lru.js:458
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
No description provided.