Message232476
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. |
|
Date |
User |
Action |
Args |
2014-12-11 13:59:36 | ConnyOnny | set | recipients:
+ ConnyOnny |
2014-12-11 13:59:36 | ConnyOnny | set | messageid: <1418306376.38.0.155577623227.issue23030@psf.upfronthosting.co.za> |
2014-12-11 13:59:36 | ConnyOnny | link | issue23030 messages |
2014-12-11 13:59:35 | ConnyOnny | create | |
|