[issue17528] Implement dumps/loads for lru_cache

2016-11-22 Thread Raymond Hettinger

Raymond Hettinger added the comment:

FWIW, the idea did have some merit and I appreciate your submitting it.

The issues are that the net gain likely isn't worth the API complication, that 
it opens a can worms (about manipulating the cache contents beyond load and 
store), and that it is at odds with the core notion of being transparent.

FWIW, the C version of OrderedDict now makes it trivially easy to roll your own 
highly performant variants of the LRU cache.

--

___
Python tracker 

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



[issue17528] Implement dumps/loads for lru_cache

2016-11-22 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Marking this as rejected for the reasons mentions by me and Antoine.

--
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



[issue17528] Implement dumps/loads for lru_cache

2014-07-19 Thread Antoine Pitrou

Antoine Pitrou added the comment:

That doesn't sound like a good idea. lru_cache is a decorator, that acts as 
transparently as possible (i.e. the decorated function has the same metadata 
and appearance as the original function). Therefore, the lru_cache'd function 
should also pickle as a regular function - which it currently does.

Having a pickle carry all the cache overhead would actually be a regression - 
instead of a couple of bytes representing the function's global name, you could 
now get kilobytes (or more) of data representing the whole cache contents.
(and, also, it would fail if the cache contains any non-picklable data)

--
nosy: +pitrou

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



[issue17528] Implement dumps/loads for lru_cache

2014-07-18 Thread Mark Lawrence

Mark Lawrence added the comment:

https://pypi.python.org/pypi/fastcache/0.4.0 also seems relevant.

--
nosy: +BreamoreBoy
versions: +Python 3.5 -Python 3.4

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



[issue17528] Implement dumps/loads for lru_cache

2014-07-18 Thread Raymond Hettinger

Raymond Hettinger added the comment:

Have you seen something like this done for other implementations of LRU caches? 
 

To me, the idea seems to be at odds with the idea of retaining only the last n 
calls in memory -- suggesting that a refreshing an outdated entry is cheaper 
than retiring it to disk and retrieving it later (as you might do with a shelf 
or database).

--
assignee:  - rhettinger

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



[issue17528] Implement dumps/loads for lru_cache

2013-03-23 Thread Francesco Frassinelli

New submission from Francesco Frassinelli:

Hi,
I propose to change the public API of functools.lru_cache in order to make the 
cache persistent when the program is restarted.
It could be implemented using two different functions (dumps/loads), where the 
cached is exported into a classical dictionary and restored in the same way.
A third argument could be also added to provide the initial cache (calling the 
loads function internally after the initialization).

I think this could be an important enhancement because lru_cache will probably 
implemented in C and try to export cache contents it will be not possible (see: 
http://bugs.python.org/issue14373).

--
messages: 185036
nosy: frafra
priority: normal
severity: normal
status: open
title: Implement dumps/loads for lru_cache
type: enhancement

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17528
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17528] Implement dumps/loads for lru_cache

2013-03-23 Thread Ezio Melotti

Changes by Ezio Melotti ezio.melo...@gmail.com:


--
components: +Library (Lib)
nosy: +anacrolix, ezio.melotti, rhettinger
versions: +Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17528
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com