mirror of
https://github.com/python/cpython.git
synced 2026-01-05 23:12:38 +00:00
[3.12] gh-107619: Extend functools LRU cache docs with generators and async functions (GH-107934) (#108161)
gh-107619: Extend functools LRU cache docs with generators and async functions (GH-107934)
(cherry picked from commit 1a713eac47)
Co-authored-by: Hadházy Tamás <85063808+Hels15@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
parent
1e46f1a9a4
commit
fbe1cff015
1 changed files with 3 additions and 2 deletions
|
|
@ -226,8 +226,9 @@ The :mod:`functools` module defines the following functions:
|
|||
|
||||
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().
|
||||
functions with side-effects, functions that need to create
|
||||
distinct mutable objects on each call (such as generators and async functions),
|
||||
or impure functions such as time() or random().
|
||||
|
||||
Example of an LRU cache for static web content::
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue