diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2022-09-18 21:36:20 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-18 21:36:20 (GMT) |
commit | bbc24b2bd569108b957ed24c5a95ffeaf8cde0db (patch) | |
tree | 52a9f3b67ab88e0e0e3bff6197577a9d24c2b1c7 /Doc | |
parent | 2d1a2d902a0daa39c340ea0a0f0565f249d8fc17 (diff) | |
download | cpython-bbc24b2bd569108b957ed24c5a95ffeaf8cde0db.zip cpython-bbc24b2bd569108b957ed24c5a95ffeaf8cde0db.tar.gz cpython-bbc24b2bd569108b957ed24c5a95ffeaf8cde0db.tar.bz2 |
GH-96851: Add link to FAQ entry for caching method calls. (GH-96902)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/faq/programming.rst | 2 | ||||
-rw-r--r-- | Doc/library/functools.rst | 3 |
2 files changed, 5 insertions, 0 deletions
diff --git a/Doc/faq/programming.rst b/Doc/faq/programming.rst index 6514c00..a3fb2fa 100644 --- a/Doc/faq/programming.rst +++ b/Doc/faq/programming.rst @@ -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? ---------------------------- diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst index 47cbe59..943a05c 100644 --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -197,6 +197,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 |