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

Auto-Cache Clean / Garbage Collection #458

Open
stealthco-tony opened this issue Oct 13, 2024 · 1 comment
Open

Auto-Cache Clean / Garbage Collection #458

stealthco-tony opened this issue Oct 13, 2024 · 1 comment

Comments

@stealthco-tony
Copy link

Expected Behaviour

Expect the service to automatically clean the cache once the rate_limit has expired (for the given Key). For example, if the key_func is IP Address, and we set a limit of 1 time per hour, once Flask limiter determines the hour has passed, it should clear the cache. There is no point/need in keeping old requests that are outside the limiting time period once the period has passed (if anything, they should be logged in a more persistent storage, not memorystorage).

For v1 of this new feature, I would expect it to check on every call of the decorated route(s). For v2, you could spin off a separate microservice that is constantly monitoring and clearing caches (even a paid upgrade).

Thanks!

@Shellcat-Zero
Copy link

I was about to ask about this because I couldn't find an answer in the documentation. Does the memory keep filling up then, the longer that the flask app is running? I would expect periodic garbage collection, at the very least, probably when receiving another event that checks the limiter, and then at that time the limiter deletes expired entries. If doing it on every event might be too expensive, then there probably needs to be some configurable parameter to clean the cache every N events, or something similar.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants