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

Alternative cost/weight per entry #150

Open
fourth44 opened this issue Jul 2, 2023 · 1 comment
Open

Alternative cost/weight per entry #150

fourth44 opened this issue Jul 2, 2023 · 1 comment

Comments

@fourth44
Copy link

fourth44 commented Jul 2, 2023

Use case: a cache of document collections. Each entry can have a small or large number of documents, which can be varying in size themselves. Eviction should happen because of the memory heap being to full; so if there is 500 MB 'free' then I can either allow insertion of many small document collections or perhaps just one big collection.

Currently the 'size' of the cache is just the amount of entries (weight fixed to 1), I would like to allow the lookup function to provide arbitrary weights (float/double).

@fourth44
Copy link
Author

fourth44 commented Jul 20, 2023

I now realize that this would have been possible with CachePolicy and Evict strategies, which seem to have been removed entirely. I would agree with remark #11 (comment).

Is there any chance that revived effort (a PR to support different ordering than LRU) could be accepted, or is there consensus to only have the current efficient implementation based on LRU?
If that is the case, the website should no longer mention 'compositional cache strategies'.

Edit: I think the order of eviction is not the issue, but rather the ability to evict the LRU item at different conditions than just size > capacity. However such a different strategy would require insight in what items are currently stored (see #45 (comment)).

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