Skip to content

Handle zero-capacity cache safely#113

Open
fallintoplace wants to merge 1 commit into
NVIDIA:mainfrom
fallintoplace:fix/zero-capacity-cache
Open

Handle zero-capacity cache safely#113
fallintoplace wants to merge 1 commit into
NVIDIA:mainfrom
fallintoplace:fix/zero-capacity-cache

Conversation

@fallintoplace

Copy link
Copy Markdown

Summary

Treat a cache capacity of 0 as an explicitly disabled cache instead of entering CAR replacement on the first insert.

Details

CacheSettings::with_capacity(0) can currently build a CarCache with empty clock lists. On the first cache miss, put sees len == capacity, calls replace, and the clock hand can advance with modulo zero.

This keeps the existing usize API intact and makes the compatible behavior explicit: capacity 0 stores no entries and returns cache misses.

Validation

  • cargo test -p nv-redfish-bmc-http

@copy-pr-bot

copy-pr-bot Bot commented Jun 13, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

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