[New-bugs-announce] [issue28112] Add callback to functools.lru_cache

Alex Jurkiewicz report at bugs.python.org
Tue Sep 13 00:53:35 EDT 2016


New submission from Alex Jurkiewicz:

I'd like to add support for functools.lru_cache to have a callback parameter that runs every time an item is evicted from the cache. I've written a small prototype here:

https://github.com/alexjurkiewicz/cpython/commit/2f788387466720d47f2c82242ac33b107b0bf470

The prototype is incomplete:
* No C implementation
* Doesn't run on lru_cache.cache_clear()
* It would be nice to pass through args/kwargs for each evicted item

Comments welcome!

----------
components: Library (Lib)
messages: 276171
nosy: aj
priority: normal
severity: normal
status: open
title: Add callback to functools.lru_cache
type: enhancement
versions: Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28112>
_______________________________________


More information about the New-bugs-announce mailing list