diff options
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/functools.rst | 14 | ||||
-rw-r--r-- | Doc/whatsnew/3.2.rst | 2 |
2 files changed, 12 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. diff --git a/Doc/whatsnew/3.2.rst b/Doc/whatsnew/3.2.rst index 1edbf50..91ab849 100644 --- a/Doc/whatsnew/3.2.rst +++ b/Doc/whatsnew/3.2.rst @@ -332,6 +332,8 @@ New, Improved, and Deprecated Modules c.execute('SELECT phonenumber FROM phonelist WHERE name=?', (name,)) return c.fetchone()[0] + XXX: update for Issue 10586 changes to cache statistics API + To help with choosing an effective cache size, the wrapped function is instrumented with two attributes *cache_hits* and *cache_misses*: |