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

function to evict one item #459

Open
trinity-1686a opened this issue Oct 2, 2024 · 0 comments
Open

function to evict one item #459

trinity-1686a opened this issue Oct 2, 2024 · 0 comments

Comments

@trinity-1686a
Copy link

currently moka allow limiting entries it stores using item weights. If a weighter is provided, the weights it returns are used, otherwise all weights are assumed to be one, which means the limit is in number of items and not based on their size.

I'd like to be able to limit both total weight, and number of items. Afaict, there isn't currently a way to do that. One thing i thought of that would allow being more generic on unusual constraints like that would be to provide an fn evict(&self) -> Option<K, V> which evicts one item according to some application rules, while still leveraging moka's eviction policy

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

No branches or pull requests

1 participant