Skip to content

Commit

Permalink
[3.12] gh-107619: Extend functools LRU cache docs with generators and…
Browse files Browse the repository at this point in the history
… async functions (GH-107934) (#108161)

gh-107619: Extend functools LRU cache docs with generators and async functions (GH-107934)
(cherry picked from commit 1a713ea)

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>
  • Loading branch information
4 people committed Aug 20, 2023
1 parent 1e46f1a commit fbe1cff
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Doc/library/functools.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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::

Expand Down

0 comments on commit fbe1cff

Please sign in to comment.