Skip to content

Conversation

@levkk
Copy link
Contributor

@levkk levkk commented Jun 26, 2025

I want promote/demote to return false if the key doesn't exist. A common pattern for me is:

if cache.contains(&key) {
     cache.promote(&key);
}

This requires to check the map twice, which for large keys, is noticeable performance-wise.

Now I can just do:

if cache.promote(&key) {
     // ...
}

@jeromefroe
Copy link
Owner

Thanks for the contribution @levkk!

@jeromefroe jeromefroe merged commit 9903725 into jeromefroe:master Jun 26, 2025
4 checks passed
@levkk levkk deleted the levkk-promote branch June 27, 2025 02:02
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