diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst index e708a0d99cd004..2bd3754596d62a 100644 --- a/Doc/library/functools.rst +++ b/Doc/library/functools.rst @@ -144,6 +144,11 @@ The :mod:`functools` module defines the following functions: functions with side-effects, functions that need to create distinct mutable objects on each call, or impure functions such as time() or random(). + The LRU cache takes string references to the arguments provided in the decorated callable + as well as the return value. Notice that this means that if a class method is decorated, the cache + will keep strong references to all arguments provided, including the instance itself (provided as the + argument of the method, normally called ``self``). This has the consequence that calling the cached + method will keep the instances alive until they are discarded by the cache or manually removed. Example of an LRU cache for static web content:: @lru_cache(maxsize=32)