New submission from Constantin: In an effort for improved communication between stacked decorators, I would like to propose that all decorators providing caching mechanisms should provide the functions cache_info, cache_clear, cache_get and cache_put. The standard lib only provides functools.lru_cache as caching decorators, which already implements the former two. I have attached a patch to provide the latter two.
On python-ideas there was also the idea to create a cache data structure and then have a decorator take its data structure as an argument. But it was argued that this could lead to some optimizations of the caching being impossible. I think my suggested approach should not impose a problem on highly optimized caching code, because every cache - no matter how optimized - must have some functionality to add something to the cache and lookup something in the cache. ---------- components: Library (Lib) files: lru_get_put.patch keywords: patch messages: 232476 nosy: ConnyOnny priority: normal severity: normal status: open title: lru_cache manual get/put type: enhancement versions: Python 3.5 Added file: http://bugs.python.org/file37415/lru_get_put.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue23030> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com