-
Notifications
You must be signed in to change notification settings - Fork 156
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
Adding maxsize in the decorator #429
Comments
I have personally developed two simple plugins specifically for that, there weren't there hard to cook up. Perhaps that is the reason why that's not done by default :). But I am new to this library, still testing it so it's hard for me to judge. |
@Maxyme that's a very old PR and removed that feature because I was adding it initially for all backends but this only makes sense for memory one as redis and memcached control this in the backend side.
@kornicameister you're right. Its not hard to do this with a plugin but I think it would make sense to add this behavior in the memory backend as a feature. I'll leave this ticket open to implement that. Contributions ofc are always welcome :) |
I can't promise that I will do it, there is a lot of work and family stuff going on already (especially before Christmas). |
Any updates? |
I am trying to look into that, but for some reason neovim crashes on this repository. Like seriously, no idea what's wrong ;P. I will try to fix that or use another editor but that;s strange. PS. Should this be available only for |
Hey @kornicameister yes, Redis and Memcached have other mechanisms like memory limit, lru policies, etc. for controlling the behavior, doing this from client side doesn't make sense as you could have multiple workers working against the same Redis/Memcached. So yes, only for SimpleMemoryCache |
Closing in favor of more recent #498 |
lru_tools (and alru_tools) support a maxsize option in the decorator:
@alru_cache(maxsize=32)
Seeing that a pr was merged with the notion of max_keys per cache: #17, how hard would it be to implement a maxsize argument for the decorator?
I can see this being useful to have a simple way to prevent the in-memory cache from getting too big.
The text was updated successfully, but these errors were encountered: