Skip to content

Refactor ClockRing insert logic to optimize slot usage and prevent …#26

Merged
TKorr merged 1 commit intomainfrom
fix/clock-eviction-on-non-empty-ring
Feb 23, 2026
Merged

Refactor ClockRing insert logic to optimize slot usage and prevent …#26
TKorr merged 1 commit intomainfrom
fix/clock-eviction-on-non-empty-ring

Conversation

@TKorr
Copy link
Contributor

@TKorr TKorr commented Feb 23, 2026

…unnecessary evictions

  • Enhanced the insert method to utilize empty slots when available, ensuring that entries are not evicted when the cache has free space.
  • Implemented a two-pass CLOCK sweep for eviction, maintaining reference bits for entries to improve eviction accuracy.
  • Added regression tests to verify that inserts do not evict existing entries when there are available slots, ensuring correct behavior under various scenarios.
  • Updated documentation and tests to reflect these changes, improving clarity and usability of the ClockRing API.

Description

Related Issue

Fixes #

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

How Has This Been Tested?

  • Unit tests

Test environment:

  • OS:
  • Rust version:

Checklist

  • My code follows the project's coding standards
  • I have run cargo fmt and cargo clippy
  • I have added tests for my changes
  • All new and existing tests pass (cargo test)
  • I have updated the documentation as needed
  • I have added an entry to CHANGELOG.md (if applicable)

…unnecessary evictions

- Enhanced the `insert` method to utilize empty slots when available, ensuring that entries are not evicted when the cache has free space.
- Implemented a two-pass CLOCK sweep for eviction, maintaining reference bits for entries to improve eviction accuracy.
- Added regression tests to verify that inserts do not evict existing entries when there are available slots, ensuring correct behavior under various scenarios.
- Updated documentation and tests to reflect these changes, improving clarity and usability of the `ClockRing` API.
@TKorr TKorr merged commit de0517e into main Feb 23, 2026
16 checks passed
@TKorr TKorr deleted the fix/clock-eviction-on-non-empty-ring branch February 23, 2026 10:20
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