[issue30153] lru_cache should support invalidations

2017-04-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: If you're interested, here is a starting point for experimenting with any variations you want (invalidate a specific entry, changeable maxsize, pickle/unpickle, expiration of entries after a specific time, inspection of the internal contents, ability to inj

[issue30153] lru_cache should support invalidations

2017-04-24 Thread Raymond Hettinger
Raymond Hettinger added the comment: Sorry Jesús, I don't want to add feature creep to the LRU cache. FWIW, it is very easy to make your own variants from collections.OrderedDict. -- resolution: -> rejected stage: needs patch -> resolved status: open -> closed

[issue30153] lru_cache should support invalidations

2017-04-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: This is a duplicate of rejected issue28178. See also related issue17528, issue18577, issue19859, issue23030, issue26082, and issue28112. -- assignee: -> rhettinger ___ Python tracker

[issue30153] lru_cache should support invalidations

2017-04-24 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Could cache_clear() clear the entire cache or discard just the cached call without arguments? -- nosy: +serhiy.storchaka ___ Python tracker _

[issue30153] lru_cache should support invalidations

2017-04-24 Thread Steven D'Aprano
Steven D'Aprano added the comment: Perhaps the existing ``cache_clear`` method could take optional arguments? def cache_clear(self, *args, **kw): if not (args or kw): # clear the entire cache else: # clear just the cache entry for *args, **kw -- components: +Libr

[issue30153] lru_cache should support invalidations

2017-04-24 Thread Jesús Cea Avión
New submission from Jesús Cea Avión: I think that "functools.lru_cache()" should have the ability to "invalidate" a (possibly cached) value. Something like: @functools.lru_cache() def func(param): ... func.invalidate(PARAM) # discard this cached call, or ignore if not cached -- mess