Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not cache anything when max capacity is zero #238

Merged
merged 3 commits into from
Mar 4, 2023

Conversation

tatsuya6502
Copy link
Member

To fix #230, make the cache implementations to store nothing when the max capacity is set to 0.

Changes

When the max capacity is set to 0, cache will do the followings:

  • Create the internal concurrent hash map with initial capacity of 0.
  • Do not enable the frequency sketch.
  • Make the following methods to do nothing and return immediately:
    • internal insert_with_hash
    • internal do_get_with_hash
    • external sync

Also added unit test called max_capacity_zero.

Verification

  • Ran all unit tests and they all passed.
    • command: RUSTFLAGS='--cfg skeptic --cfg trybuild' cargo test -F future

@tatsuya6502 tatsuya6502 self-assigned this Mar 4, 2023
@tatsuya6502 tatsuya6502 added the bug Something isn't working label Mar 4, 2023
@tatsuya6502 tatsuya6502 added this to the v0.10.1 milestone Mar 4, 2023
Copy link
Member Author

@tatsuya6502 tatsuya6502 left a comment

Choose a reason for hiding this comment

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

Merging.

@tatsuya6502 tatsuya6502 added this pull request to the merge queue Mar 4, 2023
Merged via the queue into master with commit 0dac6fc Mar 4, 2023
@tatsuya6502 tatsuya6502 deleted the max-capacity-zero branch April 12, 2023 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cache with max capacity of zero should not cache anything
1 participant