Skip to content

function to evict one item #459

@trinity-1686a

Description

@trinity-1686a

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

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions