[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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue28178] allow to cache_clear(some_key) in lru_cache

2016-09-17 Thread Raymond Hettinger

Changes by Raymond Hettinger :


--
assignee:  -> rhettinger

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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 
alternate caching libraries for folks that are looking for features that 
standard implementation doesn't provide.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[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() # -> this clears the whole cache
foo.clear_cache(1) # -> this would clear the cache entry for 1

--
components: Library (Lib)
messages: 276680
nosy: Sébastien de Menten
priority: normal
severity: normal
status: open
title: allow to cache_clear(some_key) in lru_cache
type: enhancement

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com