10000 GH-93179: Document the thread safety of functools.lru_cache by rhettinger · Pull Request #95970 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

GH-93179: Document the thread safety of functools.lru_cache #95970

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

Merged
merged 1 commit into from
Aug 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
GH-93179: Document the thread safety of functools.lru_cache
  • Loading branch information
rhettinger committed Aug 13, 2022
commit 1f034ed7670c65805fe4ffed03852b9dcd4adb3a
6 changes: 6 additions & 0 deletions Doc/library/functools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ The :mod:`functools` module defines the following functions:
>>> factorial(12) # makes two new recursive calls, the other 10 are cached
479001600

The cache is threadsafe so the wrapped function can be used in multiple
threads.

.. versionadded:: 3.9


Expand Down Expand Up @@ -140,6 +143,9 @@ The :mod:`functools` module defines the following functions:
*maxsize* most recent calls. It can save time when an expensive or I/O bound
function is periodically called with the same arguments.

The cache is threadsafe so the wrapped function can be used in multiple
threads.

Since a dictionary is used to cache results, the positional and keyword
arguments to the function must be hashable.

Expand Down
0