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

Clean up request locks #228

Closed
JWCook opened this issue Feb 26, 2024 · 0 comments
Closed

Clean up request locks #228

JWCook opened this issue Feb 26, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@JWCook
Copy link
Member

JWCook commented Feb 26, 2024

Follow-up from #227.

For a long-running cache with a large number of unique requests, the number of cache keys in memory could start to add up. With the current hash function (sha256), that's roughly 1MB per 6K unique requests (~113B per the hex digest, ~56B per lock object).

Possible solutions would include:

  • Adding a fixed TTL to each lock and run cleanup after every request
  • Something like lru-dict, but ideally without adding another dependency.
    • A wrapper function + functools.lru_cache might be sufficient.
@JWCook JWCook added the enhancement New feature or request label Feb 26, 2024
@JWCook JWCook closed this as completed Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant