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

Meaning of the cache capacity #12

Open
flosse opened this issue Feb 2, 2024 · 1 comment
Open

Meaning of the cache capacity #12

flosse opened this issue Feb 2, 2024 · 1 comment

Comments

@flosse
Copy link

flosse commented Feb 2, 2024

Why is 255 always used for the capacity in the examples?
What exactly does this mean and what effects would a different value have?

@billythedummy
Copy link
Owner

billythedummy commented Feb 3, 2024

Why is 255 always used for the capacity in the examples?

No real reason, just because it's the largest possible capacity size for generic I with type u8

What exactly does this mean and what effects would a different value have?

The capacity of the ConstLru is the maximum number of items you can store in it. Beyond that, attempting to insert an item with a new key will evict the least recently used item. See docs for https://docs.rs/const-lru/latest/const_lru/struct.ConstLru.html#method.insert. Increasing it will increase the size of the ConstLru by the number of bytes required to store the additional keys, values, and additional indexes

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

2 participants