diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2022-08-18 22:38:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-18 22:38:49 (GMT) |
commit | ba4bb7e4649be99d5d6b4151a1bd2eac89ef97f2 (patch) | |
tree | e730d62d3f4b581850b2d7df60bd70cabf0a3c48 | |
parent | 214eb2cce5caa99f476ae8abd406077e2c293a3c (diff) | |
download | cpython-ba4bb7e4649be99d5d6b4151a1bd2eac89ef97f2.zip cpython-ba4bb7e4649be99d5d6b4151a1bd2eac89ef97f2.tar.gz cpython-ba4bb7e4649be99d5d6b4151a1bd2eac89ef97f2.tar.bz2 |
GH-93179: Document the thread safety of functools.lru_cache (GH-95970)
-rw-r--r-- | Doc/library/functools.rst | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst index 00aca09..47cbe59 100644 --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -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 @@ -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. |