[issue28112] Add callback to functools.lru_cache

2016-09-12 Thread Alex Jurkiewicz
Alex Jurkiewicz added the comment: OK, thanks for the feedback. For future searchers I am using the pylru module instead: https://pypi.python.org/pypi/pylru -- ___ Python tracker __

[issue28112] Add callback to functools.lru_cache

2016-09-12 Thread Raymond Hettinger
Raymond Hettinger added the comment: Alex, I would like to pass on this feature request and keep the lru_cache API focused on its core task. As it stands now, it was already difficult to fight reentrancy problems. FWIW, it is very easy to roll your own LRU variants using collections.OrderedD

[issue28112] Add callback to functools.lru_cache

2016-09-12 Thread Berker Peksag
Changes by Berker Peksag : -- nosy: +ncoghlan, rhettinger stage: -> needs patch versions: -Python 3.3, Python 3.4, Python 3.5, Python 3.6 ___ Python tracker ___ ___

[issue28112] Add callback to functools.lru_cache

2016-09-12 Thread Alex Jurkiewicz
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/2f788387466720d47f2c82242ac33b107b0bf4