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

cache_none option for memoize to deal with concurrency problem #140

Merged

Conversation

joeportela
Copy link
Contributor

Fixes #135 by allowing the user to specify if their function never returns None. If so, we can safely assume a None returned from cache.get() means the key does not exist.

@coveralls
Copy link

coveralls commented Nov 12, 2019

Coverage Status

Coverage increased (+0.04%) to 79.469% when pulling b2394e9 on joeportela:jp/concurrency_problem_135 into f84c635 on sh4nks:master.

@joeportela
Copy link
Contributor Author

Also want to consider the defaulting the value to False or making the kwarg 'cache_none' to make things a bit more clear.

@gergelypolonkai
Copy link
Collaborator

Yes, please change it to False by default, so we revert back to 1.7.1 functionality. It was much better for everyone, or so it seems.

@joeportela
Copy link
Contributor Author

Yes, please change it to False by default, so we revert back to 1.7.1 functionality. It was much better for everyone, or so it seems.

Changed the default value to False and also changed the kwarg to 'cache_none'. I think for a user, the decision to cache None values is a simpler one to make (don't) than deciding if their function may ever return a None value.

@joeportela joeportela changed the title returns_none option for memoize to deal with concurrency problem cache_none option for memoize to deal with concurrency problem Nov 13, 2019
@gergelypolonkai
Copy link
Collaborator

Thanks!

@gergelypolonkai gergelypolonkai merged commit 9bea2c4 into pallets-eco:master Nov 14, 2019
@joeportela joeportela deleted the jp/concurrency_problem_135 branch November 14, 2019 18:25
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Concurrency problem
3 participants