Skip to content

Fix Advanced Lru Cache 142 - #234

Merged
igorwojda merged 1 commit into
mainfrom
fix-advanced-lru-cache-142
Sep 5, 2026
Merged

Fix Advanced Lru Cache 142#234
igorwojda merged 1 commit into
mainfrom
fix-advanced-lru-cache-142

Conversation

@igorwojda

Copy link
Copy Markdown
Owner

No description provided.

Reading an expired item removed it from both queues but left it in the
map, so the stale entry kept counting toward the capacity and later puts
evicted live items instead. Drop the whole entry, and keep the map in
sync with the touched instance re-inserted into the priority queue.

The README also described eviction as "earliest expiry time, then lowest
priority, then LRU", while the solution and tests evict by priority and
last used only (expiry gates validity, not ordering). Align the wording
and document the O(n) bound of the PriorityQueue based implementation.

Refs #142

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@igorwojda
igorwojda merged commit 6b3ad7f into main Sep 5, 2026
1 check passed
@igorwojda
igorwojda deleted the fix-advanced-lru-cache-142 branch September 5, 2026 11:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant