kids.cache icon indicating copy to clipboard operation
kids.cache copied to clipboard

Using WeakValueDictionary as a cachestore

Open vaab opened this issue 10 years ago • 0 comments

This is a copy of Thomas Kemmer email suggestion::

A last one for today: I only recently came across

https://docs.python.org/3/library/weakref.html

I think WeakValueDictionary makes for a very interesting "standard" cache-like class. Maybe you don't want to replace good old dict as your default, but you should definitely check your decorator works with it, and maybe say so in the docs. Since it's quite a new thing, even seasoned Python programmers may not have heard about it.

vaab avatar Feb 02 '15 02:02 vaab