diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-11-25 17:01:09 -0800 |
---|---|---|
committer | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2018-11-25 17:01:09 -0800 |
commit | 6c12091ca67e8ec2960652ef7a763d0de772f799 (patch) | |
tree | 8ac56dc94b05d873e465b695b25ce4b1b5730e97 /Doc | |
parent | closes bpo-35309: cpath should be capath (GH-10702) (diff) | |
download | cpython-6c12091ca67e8ec2960652ef7a763d0de772f799.tar.gz cpython-6c12091ca67e8ec2960652ef7a763d0de772f799.tar.bz2 cpython-6c12091ca67e8ec2960652ef7a763d0de772f799.zip |
bpo-35300: Add usage note to the lru_cache() docs (GH-10707) (GH-10709)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/functools.rst | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst index b221a8584a1..41c06c647b7 100644 --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -80,6 +80,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) |