Conversation
…or (insert order and access order)
…ooling; tests: add LRU, Clock, CAWOLFU eviction tests
…, Clock, CAWOLFU; fix Evict key handling in Clock & CAWOLFU
|
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 PR introduces comprehensive improvements to the eviction algorithms package by adding test coverage for all cache eviction strategies and fixing bugs related to returning previously deleted keys after pool recycling.
- Adds comprehensive test suites for LRU, LFU, Clock, CAWOLFU, and ARC eviction algorithms
- Fixes critical bugs in Clock and CAWOLFU algorithms where evicted keys could be returned after the underlying objects were recycled to pools
- Completely rewrites the ARC algorithm implementation with proper doubly-linked lists and ghost list management
Reviewed Changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/eviction/lru_test.go | Comprehensive test suite for LRU algorithm covering eviction order, zero capacity, and deletion scenarios |
| pkg/eviction/lfu_test.go | Test suite for LFU algorithm including tie-breaking behavior and access order scenarios |
| pkg/eviction/clock_test.go | Tests for Clock algorithm focusing on access count handling and eviction behavior |
| pkg/eviction/cawolfu_test.go | Test coverage for CAWOLFU algorithm eviction and deletion functionality |
| pkg/eviction/arc_test.go | Test suite for ARC algorithm covering basic operations and ghost list behavior |
| pkg/eviction/clock.go | Bug fix to preserve evicted key before recycling item to pool |
| pkg/eviction/cawolfu.go | Bug fix to preserve evicted key before resetting node for pool reuse |
| pkg/eviction/arc.go | Complete rewrite with proper ARC implementation using doubly-linked lists and ghost management |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
|
|
||
| return b | ||
| } |
There was a problem hiding this comment.
This function duplicates the built-in max function that's available in Go 1.21+. Consider using the standard library's max(a, b) function instead of defining a custom arcIntMax function.
| } |
No description provided.