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

Allow to change MaxSize while running #41

Closed
bep opened this issue Jun 26, 2020 · 4 comments
Closed

Allow to change MaxSize while running #41

bep opened this issue Jun 26, 2020 · 4 comments

Comments

@bep
Copy link
Contributor

bep commented Jun 26, 2020

First, thanks for this library, I tested this here and it works great.

I have one challenge (which I may just skip in its first version) though, and that is how to control the size of the cache.

I understand that you can somehow control this by implementing Size() (the same strategy as used by Ristretto, but implementing that in a general way for structs/maps seems to be non-trivial. For my use case I can probably do some approximations.

Which is why I'm lifting the idea about a SetMaxSize method that could be adjust while running to handle "low on memory" situations.

@karlseguin
Copy link
Owner

40275a3

?

@bep
Copy link
Contributor Author

bep commented Jun 26, 2020

Yes, that looks great.

@karlseguin
Copy link
Owner

This is in master now. Thanks for the suggestion!

@bep
Copy link
Contributor Author

bep commented Jun 26, 2020

Just tested it -- works great. I still need to do some thinking about "how to best" do these adjustments, but this is a much simpler mental model than the other one. I think this will be useful to many, thanks again.

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