[issue28178] allow to cache_clear(some_key) in lru_cache

2016-09-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: FYI, here is a starting point for rolling your own variants. The OrderedDict makes this effortless. http://pastebin.com/LDwMwtp8 -- ___ Python tracker

[issue28178] allow to cache_clear(some_key) in lru_cache

2016-09-17 Thread Raymond Hettinger
Raymond Hettinger added the comment: I concur with Nick that the API needs to be relatively simple. The availability of a fast ordered dictionary now makes it very easy for people to roll their own customizations. -- resolution: -> rejected status: open -> closed

[issue28178] allow to cache_clear(some_key) in lru_cache

2016-09-17 Thread Raymond Hettinger
Changes by Raymond Hettinger : -- assignee: -> rhettinger ___ Python tracker ___

[issue28178] allow to cache_clear(some_key) in lru_cache

2016-09-17 Thread Nick Coghlan
Nick Coghlan added the comment: I'm wary of adding too much complexity to the standard cache API, especially when it's something that isn't found in http://boltons.readthedocs.io/en/latest/cacheutils.html either. I do think it could be a good idea to provide some "See Also" links to

[issue28178] allow to cache_clear(some_key) in lru_cache

2016-09-16 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Method with name clear() usually removes all content. It would be better to use different name: remove() or invalidate() (is there a precedence in other caches?). -- nosy: +ncoghlan, rhettinger, serhiy.storchaka versions: +Python 3.7

[issue28178] allow to cache_clear(some_key) in lru_cache

2016-09-16 Thread Sébastien de Menten
New submission from Sébastien de Menten: It would be useful to be able to clear a single item in the cache of a lru_cache decorated function. Currently with: @lru_cache def foo(i): return i*2 foo(1)# -> add 1 as key in the cache foo(2)# -> add 2 as key in the cache foo.clear_cache()