Skip to content

Standardize entry-bounded and weight-bounded naming in ConcurrentLfu - #837

Open
bitfaster wants to merge 2 commits into
mainfrom
refactor/lfu-eviction-naming
Open

bitfaster wants to merge 2 commits into
mainfrom
refactor/lfu-eviction-naming

Conversation

@bitfaster

Copy link
Copy Markdown
Owner

Use EntryBounded when capacity limits the number of entries and WeightBounded when it limits their total weight. The LFU factories, eviction policies, node types, test fixtures and helpers now use the same terminology. The counters say what they measure (TotalWeight, WindowWeight, ProtectedWeight), and AccountedWeight distinguishes the weight already applied by maintenance from the entry’s current Weight.

Use WithWeightCalculator to supply an IWeightCalculator. Both READMEs now demonstrate the actual builder API instead of WithWeigher.

Compatibility: WithWeightedEntries(weigher: ...) still works, including its original null-argument diagnostic. The CachePolicy constructor also keeps its weightedEviction parameter for named-argument callers. Eviction, trimming, expiry, and event behavior are unchanged.

bitfaster and others added 2 commits November 29, 2026 06:07
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Distinguish eviction modes from the weights they track throughout the implementation, tests, and examples. Keep the original builder spelling and its named argument as a compatible alias.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
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