Skip to content

Allow access to evicted keys and values #5

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

austinhartzheim
Copy link
Contributor

Allows access to keys and values evicted from the cache due to lack of available space. In some cases, the key might need to be cloned so that it may be added to the ghost list and returned to the user.

Allow access to keys and values evicted from the cache due to lack of
available space. In some cases, the key might need to be cloned so that
it may be added to the ghost list and returned to the user.
Add RefOrOwned enum to allow returning either owned or borrowed keys
from insert_remove. This prevents cloning the key when updating the
ghost list and allows use of the method when T does not implement Clone.
@austinhartzheim
Copy link
Contributor Author

I've updated this PR to remove the requirement K: Clone from the insert_remove methods. Instead, those methods return an enum indicating if the key is owned or borrowed and therefore avoids potentially unnecessary clones.

Let me know if you think this style of API aligns with your objectives for this crate.

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