summaryrefslogtreecommitdiffstats
path: root/Doc/library/functools.rst
diff options
context:
space:
mode:
authorNick Coghlan <ncoghlan@gmail.com>2010-11-30 06:19:46 (GMT)
committerNick Coghlan <ncoghlan@gmail.com>2010-11-30 06:19:46 (GMT)
commit234515afe594e5f9ca1b3f460735c68b04c031e2 (patch)
tree30efe3349cc7414e4f0f6d45f50a984558caea19 /Doc/library/functools.rst
parentff27ee0b400030419cfd3c9966f275bfbcb569f8 (diff)
downloadcpython-234515afe594e5f9ca1b3f460735c68b04c031e2.zip
cpython-234515afe594e5f9ca1b3f460735c68b04c031e2.tar.gz
cpython-234515afe594e5f9ca1b3f460735c68b04c031e2.tar.bz2
Issue 10586: change the new functools.lru_cache implementation to expose the maximum and current cache sizes through the public statistics API. This API is now a single function that returns a named tuple.
Diffstat (limited to 'Doc/library/functools.rst')
-rw-r--r--Doc/library/functools.rst14
1 files changed, 10 insertions, 4 deletions
diff --git a/Doc/library/functools.rst b/Doc/library/functools.rst
index 82238fd..a8fc856 100644
--- a/Doc/library/functools.rst
+++ b/Doc/library/functools.rst
@@ -52,10 +52,16 @@ The :mod:`functools` module defines the following functions:
results, the positional and keyword arguments to the function must be
hashable.
- The wrapped function is instrumented with two attributes, :attr:`cache_hits`
- and :attr:`cache_misses` which count the number of successful or unsuccessful
- cache lookups. These statistics are helpful for tuning the *maxsize*
- parameter and for measuring the cache's effectiveness.
+ The wrapped function is instrumented with a :attr:`cache_info` attribute that
+ can be called to retrieve a named tuple with the following fields:
+
+ - :attr:`maxsize`: maximum cache size (as set by the *maxsize* parameter)
+ - :attr:`size`: current number of entries in the cache
+ - :attr:`hits`: number of successful cache lookups
+ - :attr:`misses`: number of unsuccessful cache lookups.
+
+ These statistics are helpful for tuning the *maxsize* parameter and for measuring
+ the effectiveness of the cache.
The wrapped function also has a :attr:`cache_clear` attribute which can be
called (with no arguments) to clear the cache.