bpo-35300: Add usage note to the lru_cache() docs (GH-10707)

https://bugs.python.org/issue35300
This commit is contained in:
Raymond Hettinger 2018-11-25 16:24:52 -08:00 committed by Miss Islington (bot)
parent ec13b9322d
commit f0e0f2008d
1 changed files with 5 additions and 0 deletions

View File

@ -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)