eviction: fix LFU tie-breaking with LRU-on-ties using monotonic seq; …#43
eviction: fix LFU tie-breaking with LRU-on-ties using monotonic seq; …#43
Conversation
…remove ARC from default registry; docs: mark ARC experimental and list algorithm names; minor readme typo; middleware: tidy comments
|
Running Code Quality on PRs by uploading data to Trunk will soon be removed. You can still run checks on your PRs using trunk-action - see the migration guide for more information. |
There was a problem hiding this comment.
Pull Request Overview
This pull request improves the LFU eviction algorithm's tie-breaking mechanism and updates documentation to clarify algorithm availability. The primary change implements proper LRU-on-ties behavior for the LFU algorithm using a monotonic sequence counter, while also removing the experimental ARC algorithm from the default registry and improving documentation clarity.
- Fixes LFU tie-breaking to use LRU ordering instead of insertion order
- Removes ARC from default algorithm registry and marks it as experimental
- Updates documentation to list available algorithm names and corrects a typo
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/eviction/lfu.go | Implements monotonic sequence tracking for proper LRU tie-breaking in LFU algorithm |
| pkg/eviction/eviction.go | Removes ARC algorithm from default registry |
| config.go | Updates package documentation to mark ARC as experimental and remove it from default list |
| README.md | Adds algorithm names section, marks ARC as experimental, and fixes "Evitc" typo |
| pkg/middleware/otel_metrics.go | Removes obsolete comments about function ordering |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| freqs: &FrequencyHeap{}, | ||
| length: 0, | ||
| cap: capacity, | ||
| seq: 0, |
There was a problem hiding this comment.
Initializing seq to 0 creates a potential issue where the first access will have sequence 1, but tie-breaking logic expects higher values to be more recent. Consider starting from 1 or documenting that 0 represents uninitialized state.
| seq: 0, | |
| seq: 1, |
…remove ARC from default registry; docs: mark ARC experimental and list algorithm names; minor readme typo; middleware: tidy comments