Skip to content

Commit

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

Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
Co-authored-by: Kumar Aditya <kumaraditya@python.org>
  • Loading branch information
3 people committed Aug 20, 2023
1 parent b1e5d2c commit 1a713ea
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 1a713ea

Please sign in to comment.