Skip to content

fix: continue LRU eviction after removals - #1020

Merged
rueian merged 1 commit into
redis:mainfrom
siriookie:fix/lru-multi-entry-eviction
Aug 14, 2026
Merged

rueian merged 1 commit into
redis:mainfrom
siriookie:fix/lru-multi-entry-eviction

Conversation

@siriookie

@siriookie siriookie commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

#1019


Note

Low Risk
Small, localized fix to client-side LRU bookkeeping in Update, covered by a new regression test; no auth or persistence impact.

Overview
Fixes LRU eviction in Update when a newly stored value pushes c.size over c.max. The eviction walk from the list front now saves next := ele.Next() before Remove, then continues with ele = next, instead of calling Next() on a removed node (which could stop eviction early and leave stale entries).

Adds Cache Evict Multiple Entries in lru_test.go: a cache sized for two small entries must evict both when a slightly larger third entry is updated in, asserting final size, list length, and that keys 0/1 are gone while the new key remains.

Reviewed by Cursor Bugbot for commit 48a9274. Bugbot is set up for automated code reviews on this repo. Configure here.

@rueian rueian left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @siriookie

@rueian
rueian merged commit a97b666 into redis:main Aug 14, 2026
29 checks passed
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.

2 participants