mirror of
https://github.com/python/cpython.git
synced 2025-10-03 05:35:59 +00:00
GH-96851: Add link to FAQ entry for caching method calls. (GH-96902)
(cherry picked from commit bbc24b2bd5
)
Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
This commit is contained in:
parent
365f9b7b35
commit
1c345fa012
2 changed files with 5 additions and 0 deletions
|
@ -1897,6 +1897,8 @@ The classes can be used like this:
|
|||
'blog-why-python-rocks'
|
||||
|
||||
|
||||
.. _faq-cache-method-calls:
|
||||
|
||||
How do I cache method calls?
|
||||
----------------------------
|
||||
|
||||
|
|
|
@ -191,6 +191,9 @@ The :mod:`functools` module defines the following functions:
|
|||
The cache keeps references to the arguments and return values until they age
|
||||
out of the cache or until the cache is cleared.
|
||||
|
||||
If a method is cached, the `self` instance argument is included in the
|
||||
cache. See :ref:`faq-cache-method-calls`
|
||||
|
||||
An `LRU (least recently used) cache
|
||||
<https://en.wikipedia.org/wiki/Cache_replacement_policies#Least_recently_used_(LRU)>`_
|
||||
works best when the most recent calls are the best predictors of upcoming
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue