summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2018-11-26 00:24:52 (GMT)
committerMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2018-11-26 00:24:52 (GMT)
commitf0e0f2008d160cdd7e5bc02ea61c43f8c7b2b82f (patch)
treea38547fd38bcf7bd20b39e0adbe40012a520408f
parentec13b9322d95a651606219469fc7b7e9c977f248 (diff)
downloadcpython-f0e0f2008d160cdd7e5bc02ea61c43f8c7b2b82f.zip
cpython-f0e0f2008d160cdd7e5bc02ea61c43f8c7b2b82f.tar.gz
cpython-f0e0f2008d160cdd7e5bc02ea61c43f8c7b2b82f.tar.bz2
bpo-35300: Add usage note to the lru_cache() docs (GH-10707)
https://bugs.python.org/issue35300
-rw-r--r--Doc/library/functools.rst5
1 files changed, 5 insertions, 0 deletions
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst
index 40abdc2..cd59e5b 100644
--- a/Doc/library/functools.rst
+++ b/Doc/library/functools.rst
@@ -118,6 +118,11 @@ The :mod:`functools` module defines the following functions:
The cache's size limit assures that the cache does not grow without bound on
long-running processes such as web servers.
+ In general, the LRU cache should only be used when you want to reuse
+ previously computed values. Accordingly, it doesn't make sense to cache
+ functions with side-effects, functions that need to create distinct mutable
+ objects on each call, or impure functions such as time() or random().
+
Example of an LRU cache for static web content::
@lru_cache(maxsize=32)