diff options
| author | Raymond Hettinger <python@rcn.com> | 2010-09-02 09:44:28 +0000 |
|---|---|---|
| committer | Raymond Hettinger <python@rcn.com> | 2010-09-02 09:44:28 +0000 |
| commit | 38d17e3df030e443653b8999a2e3ccf12968c9ae (patch) | |
| tree | f96308bd8939a4bc9eef6cbf7beb33f56a8563eb /Lib/functools.py | |
| parent | ccb90e3ccd60bc0156905510074dce84e5b1272c (diff) | |
| download | cpython-git-38d17e3df030e443653b8999a2e3ccf12968c9ae.tar.gz | |
Speed-up cache updates
Diffstat (limited to 'Lib/functools.py')
| -rw-r--r-- | Lib/functools.py | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/Lib/functools.py b/Lib/functools.py index 1bbc520e7c..f9e35d857a 100644 --- a/Lib/functools.py +++ b/Lib/functools.py @@ -139,8 +139,7 @@ def lru_cache(maxsize=100): try: with lock: result = cache[key] - del cache[key] - cache[key] = result # record recent use of this key + cache._move_to_end(key) # record recent use of this key wrapper.hits += 1 except KeyError: result = user_function(*args, **kwds) |
