Skip to content

Feat/eviction improvements#44

Merged
hyp3rd merged 5 commits intomainfrom
feat/eviction-improvements
Aug 21, 2025
Merged

Feat/eviction improvements#44
hyp3rd merged 5 commits intomainfrom
feat/eviction-improvements

Conversation

@hyp3rd
Copy link
Copy Markdown
Owner

@hyp3rd hyp3rd commented Aug 21, 2025

No description provided.

Copilot AI review requested due to automatic review settings August 21, 2025 10:45
@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented Aug 21, 2025

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.

@hyp3rd hyp3rd merged commit 1fe7a91 into main Aug 21, 2025
2 of 3 checks passed
@hyp3rd hyp3rd deleted the feat/eviction-improvements branch August 21, 2025 10:45
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment thread pkg/eviction/arc.go
}

return b
}
Copy link

Copilot AI Aug 21, 2025

Choose a reason for hiding this comment

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

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.

Suggested change
}

Copilot uses AI. Check for mistakes.
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