Skip to content

Commit 6c12091

Browse files
miss-islingtonrhettinger
authored andcommitted
bpo-35300: Add usage note to the lru_cache() docs (GH-10707) (GH-10709)
1 parent 8c1592e commit 6c12091

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

Doc/library/functools.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ The :mod:`functools` module defines the following functions:
8080
The cache's size limit assures that the cache does not grow without bound on
8181
long-running processes such as web servers.
8282

83+
In general, the LRU cache should only be used when you want to reuse
84+
previously computed values. Accordingly, it doesn't make sense to cache
85+
functions with side-effects, functions that need to create distinct mutable
86+
objects on each call, or impure functions such as time() or random().
87+
8388
Example of an LRU cache for static web content::
8489

8590
@lru_cache(maxsize=32)

0 commit comments

Comments
 (0)