[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:
Miss Islington (bot) 2023-08-20 06:49:32 -07:00 committed by GitHub
parent 1e46f1a9a4
commit fbe1cff015
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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